繁体   English   中英

如何从flutter中的SQFLite读取数据

[英]How to read a data from SQFLite in flutter

我正在使用sqflite package 并且我想从中读取数据,表中名为my_table的表中的数据 ins 我想读取它的name属性并将它用在像文本小部件这样的小部件中这就是我所拥有的试过\

list = await db.query('my_table', 'name');
     @override
      Widget build(BuildContext context) {
        ScrollController _scrollController = new ScrollController();
        return Scaffold(
          floatingActionButton: FloatingActionButton(
            onPressed: () {
              _scrollController.jumpTo(_scrollController.position.maxScrollExtent);
            },
          ),
          body: Container(
                  color: Colors.blue,
                  height: 1000,
                  width: MediaQuery.of(context).size.width,
                  child: Text('${list}'),
                ),    );
      }

请提供更多信息!

当您使用 SQFLite 时:

读:

https://github.com/tekartik/sqflite/blob/master/sqflite/doc/sql.md

查询用于读取表内容。 它返回 map 的列表。

var list = await db.query('my_table', columns: ['name', 'type']);

我可以为 SQFLite 推荐本指南

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM