i have trouble with my flutter database , i'm using sqlite for database and when i want to run it i have error said that _CastError (Null check operator used on a null value). i already use (!)in my code but still the same ,can anybody help me
my code in dbhelbper
Future<List<DistribusiModel>> getAll() async {
final data = await _database!.query(namaTabel);
List<DistribusiModel> result =
data.map((e) => DistribusiModel.fromJson(e)).toList();
return result;
}
my code from main.dart
FutureBuilder<List<DistribusiModel>>(
future: databasedistribusi!.getAll(),
builder: (context, snapshot) {
print('Hasil: ' + snapshot.data!.toString());
return ListTile(
title: Text('Algoritma dan Pemrograman I'),
trailing: Wrap(
children: [
Text(
'3',
style: TextStyle(color: Colors.black),
),
SizedBox(
width: 20,
),
Text(
'A',
style: TextStyle(color: Colors.black),
),
SizedBox(
width: 20,
),
Text('LULUS'),
],
)
please help me , i need to finish it immediately
sorry for my bad english
i hope anyone can help me whit this problem