FlatButton(onPressed: () async {
List<Map<String, dynamic>> queryRow = await
DatabaseHelper.instance.queryAll(); print(queryRow);},
child: Text('query'), color: Colors.green[400]),
above is the code, and I can print it to the console. How can I print the result of queryRow to new screen as a list? I would like to get your kind support.
Below is the data I printed to the console:
[{_id: 1, name: John}, {_id: 2, name: Hans}, {_id: 3, name: Carol}]
FavoritesPage
import 'package:flutter/material.dart';
class FavoritesPage extends StatelessWidget {
static String id = 'favoritesPage';
@override
Widget build(BuildContext context) {
var queryRow;
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.transparent,
shadowColor: Colors.transparent,
iconTheme: IconThemeData(color: Colors.orange),
centerTitle: true,
title: const Text('Favorites', style: TextStyle(color: Colors.orange)),
elevation: 0,
),
body: ListView.builder(
itemCount: queryRow.length,
itemBuilder: (context, index) {
return ListTile(
title: Text("${queryRow[index]["name"]} - ID: ${queryRow[index]["id"]}"),
);
},
),
);
}
}