sqlife can't open errors in flutter code example

Example 1: flutter sqflite DatabaseHelper

import 'dart:async';

import 'package:eknumber/utils/database_helper.dart';
import 'package:flutter_simple_dependency_injection/injector.dart';

class Injection {
 static DatabaseHelper _databaseHelper = DatabaseHelper();
 static Injector injector;

 static Future initInjection() async {
   await _databaseHelper.initDb();
  
   injector = Injector.getInjector();


   injector.map<DatabaseHelper>((i) => _databaseHelper,
       isSingleton: true);
}
}

Example 2: flutter sqflite DatabaseHelper

class Todo{
 int id;
 String itemName;
 String dateCreated;

 Todo(
     {this.id,
     this.itemName,
     this.dateCreated})

 //to be used when inserting a row in the table
 Map<String, dynamic> toMapWithoutId() {
   final map = new Map<String, dynamic>();
   map["item_name"] = itemName;
   map["date_created"] = dateCreated;
   return map;
 }

Map<String, dynamic> toMap() {
   final map = new Map<String, dynamic>();
   map["id"] = id;
   map["item_name"] = itemName;
   map["date_created"] = dateCreated;
   return map;
 }

 //to be used when converting the row into object
 factory Todo.fromMap(Map<String, dynamic> data) => new Todo(
     id: data['id'],
     itemName: data['item_name'],
     dateCreated: data['date_created']
 );
}

Tags:

Sql Example