Questions tagged [sqflite]

Use this tag for questions about the plugin for flutter named sqflite - which enables storage, retrieval, and manipulation of SQLite databases via flutter code.

sqflite is an plugin for . Supports both and .

Package documentation: sqflite

902 questions
45
votes
1 answer

Method "join" and class "DeepCollectionEquality" aren't defined

Android Studio is giving me 2 errors using sqflite 2.2.0+3: The method join isn't defined for the class uploadIntoDb. Undefined class DeepCollectionEquality. My code : import 'package:flutter/material.dart'; import 'dart:async'; import…
Itoun
  • 3,713
  • 5
  • 27
  • 47
33
votes
1 answer

How to do a database query with SQFlite in Flutter

How do you query data from SQLite database in Flutter using the SQFlite plugin? I have been working on learning this recently, so I am adding my answer below as a means to help me learn and also as a quick reference for others in the future.
Suragch
  • 484,302
  • 314
  • 1,365
  • 1,393
25
votes
4 answers

How to sync flutter app's offline data with online database efficiently

lets say I have a todo app that stores the data in sqflite database(locally on the phone) when the app goes online I want the data to be synced with my online database say mongodb or firestore.I don't want to do complete overwrites or creating the…
Mahesh Jamdade
  • 17,235
  • 8
  • 110
  • 131
25
votes
7 answers

How to create multiple tables in a database in sqflite?

Im building and app with flutter that uses SQLite database. I have created first table using this piece of code: void _createDb(Database db, int newVersion) async { await db.execute('''CREATE TABLE cards (id_card INTEGER PRIMARY KEY, …
filiard
  • 471
  • 2
  • 6
  • 15
20
votes
4 answers

How to mock a static method in Flutter with Mockito?

I have a file a function fetchPosts() which is in charge of getting new Posts from a server and store them in a local sqlite database. As recommended on the sqflite doc, I store a single ref to my database. Here is the content of my database.dart…
Gpack
  • 1,878
  • 3
  • 18
  • 45
19
votes
7 answers

Insert multiple records in Sqflite

How to insert quickly multiple records in sqflite? The standard quickly method is: await database.insert(table, object.toMap()) But I don't think that insert record one to one with a cycle is a good idea. Or I can insert all list with a…
AlexPad
  • 10,364
  • 3
  • 38
  • 48
18
votes
1 answer

Insert sqlite flutter without freezing the interface

I'm trying to insert a lot of rows (about 12k or more) in a sqlite memory database using flutter. I get data from the API and use a compute function in order to process data from Json. Now I need to add these data to a database in memory, in order…
PsyKoWebMari
  • 415
  • 5
  • 11
18
votes
3 answers

How to do a database table update with SQFlite in Flutter

How do you update data in a table row in Flutter using the SQFlite plugin? There are a number of problem solving questions out there (see this and this) but none that I could find to add a canonical answer to. My answer is below.
Suragch
  • 484,302
  • 314
  • 1,365
  • 1,393
14
votes
2 answers

Missing Database Inspector in Android Studio

I have tried to find my Database Inspector in Android Studio in multiple ways, but to no avail: View → Tool Windows → Database Inspector is not there Help → Find Action → Database Inspector cannot be found with the search function Deleting and…
abc
  • 141
  • 1
  • 3
14
votes
11 answers

"MissingPluginException(No implementation found for method getDatabasesPath on channel com.tekartik.sqflite)" when i use floor database

I'm trying to use floor database but when i want to build database i got below error : E/flutter (26007): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: MissingPluginException(No implementation found for method getDatabasesPath on…
Taleb
  • 1,944
  • 2
  • 11
  • 36
13
votes
4 answers

Listen to real-time changes in Flutter SQFLite Database

I have a fully functional app created in Flutter. It uses sqflite plugin for storing data. I want to have a data change listener, which will update or refresh the data when new data is added or updated. How can I achieve this. I came across a…
Rehmat Singh Gill
  • 551
  • 1
  • 6
  • 15
13
votes
3 answers

Sqlite migration in flutter

I am using flutter SQflite to store data in flutter and I have no problem with it so far. Now I want to update my app and the database with it. Until now I was simply replacing the old database with the new one. But now there are some tables that I…
ouzari
  • 397
  • 3
  • 12
13
votes
2 answers

Multiple arguments in sqllite in flutter

I would like to know how to pass multiple arguments to a raw query in sqllite. My code is below query() async { // get a reference to the database Database db = await DatabaseHelper.instance.database; // raw query List result…
yoohoo
  • 1,147
  • 4
  • 22
  • 39
13
votes
4 answers

Flutter how to backup and restore sqflite database?

I'm using sqflite for my flutter project and now, I want to backup and then restore it. I searched for this issue but can't find a result. Is there any way to do it?
leehuwuj
  • 149
  • 1
  • 2
  • 6
13
votes
4 answers

Sqlite in flutter, how database assets work

I am looking at this (https://github.com/tekartik/sqflite/blob/master/doc/opening_asset_db.md) for populating data that is already formatted and need for the app, for read functionality only. So my understanding of creating an SQLite database when…
Mfreeman
  • 3,548
  • 7
  • 23
  • 37
1
2 3
59 60