floor
1.5.0, released 3 years ago by pinch.nl
A SQLite abstraction library for Flutter inspired by Room.
Quiet but busy
What it does
Floor provides automatic mapping between in-memory objects and SQLite database rows while offering full control via SQL. It uses code generation to create typesafe databases, DAOs, and entities, supporting both Futures and Streams for reactive queries.
AI-written summary of version 1.5.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You want a Room-like ORM experience for SQLite in Flutter
- You need typesafe database queries and reactive data streams
Skip it when
- You do not know SQL or SQLite
- You prefer a simple key-value store like SharedPreferences
Strengths
- Typesafe and reactive with Stream support
- Familiar Room-like architectural pattern
- Full control over underlying SQL
Weaknesses
- Requires understanding of SQL and SQLite
- Relies on code generation via build_runner
Setup
- Kind
- Flutter widgets
- Effort
- Medium
- Code generation
- Yes (build_runner)
- Direct dependencies
- 9
Requires adding floor, floor_generator, and build_runner to pubspec.yaml, and running build_runner to generate code.
final database = await $FloorAppDatabase.databaseBuilder('app_database.db').build();
final personDao = database.personDao;
final person = Person(1, 'Frank');
await personDao.insertPerson(person);
final result = await personDao.findPersonById(1);Alternatives
Packages that do the same job and could replace floor.
Works with
Packages commonly used together with floor: ones it builds on, ones built on it, and its own family.
- sqflitefloor depends on itSQLite plugin for Flutter supporting iOS, Android and MacOS.
- sqlparserfloor depends on itSQL parser and static analyzer for SQLite written in Dart.
- sqflite_common_ffifloor depends on itFFI-based implementation of sqflite for desktop platforms and unit tests.
- sqflite_common_ffi_webfloor depends on itSqflite web implementation using sqlite3 ffi and sqlite3 wasm.
- floor_annotationfloor depends on itTypesafe SQLite annotations for the Floor ORM.