hous
hous

Reputation: 2689

Flutter Sqlite , select one result from database table

I'd like know , isn't possible to select just one row from database using Flutter and Sqlite ?

I have tried this code :

// db.dart
Future<dynamic> find(Note note) async {
   await openDb();
   return await _database.query('note', where: "id = ?", whereArgs: [note.id], limit: 1);
}

// detail.dart
// note is an object
final noteO = dbmanager.find(note);
print(noteO);

the output of print(noteO) in console is :

I/flutter ( 8845): Instance of 'Future<dynamic>'

Upvotes: 1

Views: 1605

Answers (1)

F Perroch
F Perroch

Reputation: 2235

The final noteO = dbmanager.find(note); give you a Future<dynamic>.

If you want to get the result of your query, you need to put the await keyword :

final noteO = await dbmanager.find(note);

Upvotes: 2

Related Questions