sqflite

StreamBuilder throws dirty state

狂风中的少年 提交于 2019-12-13 03:22:43
问题 I am trying to fetch some data from the internet, store it to my sqlite database and display it on the screen using a ListView . When I fetch the data for the first time everything works fine and I am able to see the data on the screen, the data is also inserted in the sqlite database, but when I reopen the app I get an error saying flutter: The following NoSuchMethodError was thrown building StreamBuilder<StudentModel>(dirty, state: flutter: _StreamBuilderBaseState<StudentModel,

Flutter: passing future<int> as int to Charts

百般思念 提交于 2019-12-13 03:21:25
问题 I am making a mood checker application using flutter where user chose one of 5 emojis to tell their mood. I want to display a PieChart with data emoji vs num of Days it has been chosen. Problem is that I have to fetch data from sqflite Database to get numOfDays a particular emoji is chosen which will be of type Future but charts can't take Futures, I tried to use async-await but it didn't seem to work. Error E/flutter (27721): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception:

OnUpgrade SQFLITE: Unhandled Exception: DatabaseException(table UsernameTable has no column named rememberMe (Sqlite code 1):

独自空忆成欢 提交于 2019-12-11 16:16:09
问题 Unhandled Exception: DatabaseException(table UsernameTable has no column named rememberMe (Sqlite code 1): , while compiling: INSERT OR REPLACE INTO UsernameTable (username, rememberMe) VALUES (?, ?), (OS error - 2:No such file or directory)) sql 'INSERT OR REPLACE INTO UsernameTable (username, rememberMe) VALUES (?, ?)' args [term@melfs, 1]} I upgraded my DB. I added new column to UsernameTable Table. But It's not working. I have already so many records in this db. I can't drop So How I do

(Flutter/Dart) Two async methods in initState not working

女生的网名这么多〃 提交于 2019-12-11 15:08:49
问题 I have a function in my initState : @override void initState() { _fetchListItems(); super.initState(); } This function is very simple. It has two async await operations of sqflite , one of which waits for the other to complete in it: _fetchListItems() async { wait() async { number = await db.getNumber(userId); } await wait(); List rawFavouriteList = await db.getList(number); setState((){ rawFavouriteList.forEach((item){ _favouriteList.add(Model.map(item)); }}); } I have to wait for number to

Nested FutureBuilder vs nested calls for lazy loading from database

寵の児 提交于 2019-12-04 05:31:56
问题 I need to choose best approach between two approaches that I can follow. I have a Flutter app that use sqflite to save data, inside the database I have two tables: Employee: +-------------+-----------------+------+ | employee_id | employee_name |dep_id| +-------------+-----------------+------+ | e12 | Ada Lovelace | dep1 | +-------------+-----------------+------+ | e22 | Albert Einstein | dep2 | +-------------+-----------------+------+ | e82 | Grace Hopper | dep3 | +-------------+------------

Nested FutureBuilder vs nested calls for lazy loading from database

故事扮演 提交于 2019-12-02 03:44:42
I need to choose best approach between two approaches that I can follow. I have a Flutter app that use sqflite to save data, inside the database I have two tables: Employee: +-------------+-----------------+------+ | employee_id | employee_name |dep_id| +-------------+-----------------+------+ | e12 | Ada Lovelace | dep1 | +-------------+-----------------+------+ | e22 | Albert Einstein | dep2 | +-------------+-----------------+------+ | e82 | Grace Hopper | dep3 | +-------------+-----------------+------+ SQL: CREATE TABLE Employee( employee_id TEXT NOT NULL PRIMARY KEY, employee_name TEXT NOT