Quando clico em cadastrar recebo o erro:
import 'package:bytebank/models/shopping.dart';
import 'package:sqflite/sqflite.dart';
import 'package:bytebank/database/app_database.dart';
class ShoppingDao {
static const String tableSql = 'CREATE TABLE $_tableName('
'$_id INTEGER PRIMARY KEY, '
'$_Produto TEXT, '
'$_Fornecedor TEXT,'
'$_CNPJ INTEGER'
'$_DataPrev INTEGER'
'$_Observacao TEXT)';
static const String _tableName = 'shoppings';
static const String _id = 'id';
static const String _Produto = 'Produto';
static const String _Fornecedor = 'Fornecedor';
static const String _CNPJ = 'CNPJ';
static const String _DataPrev = 'DataPrev';
static const String _Observacao = '_Observacao';
Future<int> save(Shopping shopping) async {
final Database db = await getDatabase();
Map<String, dynamic> shoppingMap = _toMap(shopping);
return db.insert(_tableName, shoppingMap);
}
Future<List<Shopping>> findAll() async {
final Database db = await getDatabase();
final List<Map<String, dynamic>> result = await db.query(_tableName);
List<Shopping> shoppings = _toList(result);
return shoppings;
}
Map<String, dynamic> _toMap(Shopping shopping) {
final Map<String, dynamic> shoppingMap = Map();
shoppingMap[_Produto] = shopping.Produto;
shoppingMap[_Fornecedor] = shopping.Fornecedor;
shoppingMap[_CNPJ] = shopping.CNPJ;
shoppingMap[_DataPrev] = shopping.DataPrev;
shoppingMap[_Observacao] = shopping.Observacao;
return shoppingMap;
}
List<Shopping> _toList(List<Map<String, dynamic>> result) {
final List<Shopping> shoppings = List();
for (Map<String, dynamic> row in result) {
final Shopping shopping = Shopping(
row[_id],
row[_Produto],
row[_Fornecedor],
row[_CNPJ],
row[_DataPrev],
row[_Observacao],
);
shoppings.add(shopping);
}
return shoppings;
}
}
Android SQLite issue - table DataPrev has no column named