0
0
Fluttermobile~5 mins

SQLite with sqflite package in Flutter - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the sqflite package used for in Flutter?
The sqflite package is used to work with SQLite databases in Flutter apps. It allows you to store, query, update, and delete data locally on the device.
Click to reveal answer
beginner
How do you open or create a database using sqflite?
You use the openDatabase() function from sqflite. It opens an existing database or creates a new one if it doesn't exist, and you can provide a path and version.
Click to reveal answer
intermediate
What is the purpose of the onCreate callback in openDatabase?
The onCreate callback runs when the database is created for the first time. It is used to create tables and set up the initial database structure.
Click to reveal answer
beginner
How do you insert data into a SQLite table using sqflite?
You use the insert() method on the database object, passing the table name and a map of column names to values.
Click to reveal answer
intermediate
What is the difference between rawQuery() and query() methods in sqflite?
rawQuery() lets you write SQL statements as strings for complex queries, while query() provides a simpler, structured way to query tables without writing raw SQL.
Click to reveal answer
Which function is used to open or create a SQLite database in Flutter with sqflite?
AinitDatabase()
BcreateDatabase()
CopenDatabase()
DstartDatabase()
What does the onCreate callback do when opening a database?
ACreates tables and initializes the database
BUpdates the database version
CCloses the database
DDeletes the database
How do you insert a new row into a table using sqflite?
Adb.insert('table', dataMap)
Bdb.add('table', dataMap)
Cdb.create('table', dataMap)
Ddb.put('table', dataMap)
Which method allows you to run raw SQL queries in sqflite?
Aexecute()
BrawQuery()
Cquery()
DrunSQL()
What type of data structure is used to represent a row when inserting data with sqflite?
AList
BString
CSet
DMap
Explain the steps to create and open a SQLite database using the sqflite package in Flutter.
Think about how you tell sqflite where the database is and what to do when it is new.
You got /5 concepts.
    Describe how to insert and query data from a SQLite database using sqflite.
    Consider how you add data and then get it back in a Flutter app.
    You got /4 concepts.