Oi gente boa tarde, eu terminei o curso e meu código e aplicativo aparentemente estavam funcionando direitinho, mas quando eu vou clicar no botão CONTATOS lá na pagina principal do aplicativo ele carrega e dá esse erro no meu CONTACT_DAO.DART na sessão do "ID":Exception has occurred. _TypeError (type 'int' is not a subtype of type 'String')
MEU CÓDIGO:
import 'package:sqflite/sqflite.dart';
import '../../models/contact.dart';
import '../app_database.dart';
class ContactDao {
static const String tableSql = 'CREATE TABLE $_tableName('
'$_id INTEGER PRIMARY KEY, '
'$_name TEXT, '
'$_accountNumber INTEGER)';
static const String _tableName = 'contacts';
static const String _id = 'id';
static const String _name = 'name';
static const String _accountNumber = 'account_number';
Future<int> save(Contact contact) async {
final Database db = await getDatabase();
Map<String, dynamic> contactMap = _toMap(contact);
return db.insert(_tableName, contactMap);
}
Future<List<Contact>> findAll() async {
final Database db = await getDatabase();
final List<Map<String, dynamic>> result = await db.query(_tableName);
List<Contact> contacts = _toList(result);
return contacts;
}
Map<String, dynamic> _toMap(Contact contact) {
final Map<String, dynamic> contactMap = Map();
contactMap[_name] = contact.name;
contactMap[_accountNumber] = contact.accountNumber;
return contactMap;
}
List<Contact> _toList(List<Map<String, dynamic>> result) {
final List<Contact> contacts = List.empty(growable: true);
for (Map<String, dynamic> row in result) {
final Contact contact = Contact(
row[_id],
row[_name],
row[_accountNumber],
);
contacts.add(contact);
}
return contacts;
}
}