[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-9477":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":16,"stars30d":16,"stars90d":16,"forks30d":16,"starsTrendScore":16,"compositeScore":17,"rankGlobal":10,"rankLanguage":10,"license":18,"archived":19,"fork":19,"defaultBranch":20,"hasWiki":19,"hasPages":21,"topics":22,"createdAt":10,"pushedAt":10,"updatedAt":26,"readmeContent":27,"aiSummary":28,"trendingCount":16,"starSnapshotCount":16,"syncStatus":29,"lastSyncTime":30,"discoverSource":31},9477,"floor","pinchbv\u002Ffloor","pinchbv","The typesafe, reactive, and lightweight SQLite abstraction for your Flutter applications","https:\u002F\u002Fpinchbv.github.io\u002Ffloor\u002F",null,"Dart",1025,215,14,132,0,20,"Apache License 2.0",false,"develop",true,[23,24,25],"dart","flutter","sqlite","2026-06-12 02:02:08","![Floor](https:\u002F\u002Fraw.githubusercontent.com\u002Fpinchbv\u002Ffloor\u002Fdevelop\u002Fimg\u002Ffloor.png)\n\n**See the [project's website](https:\u002F\u002Fpinchbv.github.io\u002Ffloor\u002F) for the full documentation.**\n\nFloor provides a neat SQLite abstraction for your Flutter applications inspired by the [Room persistence library](https:\u002F\u002Fdeveloper.android.com\u002Ftopic\u002Flibraries\u002Farchitecture\u002Froom).\nIt comes with automatic mapping between in-memory objects and database rows while still offering full control of the database with the use of SQL.\nAs a consequence, it's necessary to have an understanding of SQL and SQLite in order to harvest Floor's full potential.\n\n- null-safe\n- typesafe\n- reactive\n- lightweight\n- SQL centric\n- no hidden magic\n- no hidden costs\n- iOS, Android, Linux, macOS, Windows\n\n⚠️ The library is open to contributions!\nRefer to [GitHub Discussions](https:\u002F\u002Fgithub.com\u002Fpinchbv\u002Ffloor\u002Fdiscussions) for questions, ideas, and discussions.\n\n[![pub package](https:\u002F\u002Fimg.shields.io\u002Fpub\u002Fv\u002Ffloor.svg)](https:\u002F\u002Fpub.dartlang.org\u002Fpackages\u002Ffloor)\n[![build status](https:\u002F\u002Fgithub.com\u002Fpinchbv\u002Ffloor\u002Fworkflows\u002FCI\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002Fpinchbv\u002Ffloor\u002Factions)\n[![codecov](https:\u002F\u002Fcodecov.io\u002Fgh\u002Fpinchbv\u002Ffloor\u002Fbranch\u002Fdevelop\u002Fgraph\u002Fbadge.svg)](https:\u002F\u002Fcodecov.io\u002Fgh\u002Fpinchbv\u002Ffloor)\n\n## Getting Started\n\n### 1. Setup Dependencies\n\nAdd the runtime dependency `floor` as well as the generator `floor_generator` to your `pubspec.yaml`.\nThe third dependency is `build_runner` which has to be included as a dev dependency just like the generator.\n\n- `floor` holds all the code you are going to use in your application.\n- `floor_generator` includes the code for generating the database classes.\n- `build_runner` enables a concrete way of generating source code files.\n\n```yaml\ndependencies:\n  flutter:\n    sdk: flutter\n  floor: ^1.4.2\n\ndev_dependencies:\n  floor_generator: ^1.4.2\n  build_runner: ^2.1.2\n```\n\n### 2. Create an Entity\n\nIt will represent a database table as well as the scaffold of your business object.\n`@entity` marks the class as a persistent class.\nIt's required to add a primary key to your table.\nYou can do so by adding the `@primaryKey` annotation to an `int` property.\nThere is no restriction on where you put the file containing the entity.\n\n```dart\n\u002F\u002F entity\u002Fperson.dart\n\nimport 'package:floor\u002Ffloor.dart';\n\n@entity\nclass Person {\n  @primaryKey\n  final int id;\n\n  final String name;\n\n  Person(this.id, this.name);\n}\n```\n\n### 3. Create a DAO (Data Access Object)\n\nThis component is responsible for managing access to the underlying SQLite database.\nThe abstract class contains the method signatures for querying the database which have to return a `Future` or `Stream`.\n\n- You can define queries by adding the `@Query` annotation to a method.\n  The SQL statement has to get added in parenthesis.\n  The method must return a `Future` or `Stream` of the `Entity` you're querying for.\n- `@insert` marks a method as an insertion method.\n\n```dart\n\u002F\u002F dao\u002Fperson_dao.dart\n\nimport 'package:floor\u002Ffloor.dart';\n\n@dao\nabstract class PersonDao {\n  @Query('SELECT * FROM Person')\n  Future\u003CList\u003CPerson>> findAllPeople();\n\n  @Query('SELECT name FROM Person')\n  Stream\u003CList\u003CString>> findAllPeopleName();\n\n  @Query('SELECT * FROM Person WHERE id = :id')\n  Stream\u003CPerson?> findPersonById(int id);\n\n  @insert\n  Future\u003Cvoid> insertPerson(Person person);\n}\n```\n\n### 4. Create the Database\n\nIt has to be an abstract class which extends `FloorDatabase`.\nFurthermore, it's required to add `@Database()` to the signature of the class.\nMake sure to add the created entity to the `entities` attribute of the `@Database` annotation.\nIn order to make the generated code work, it's required to also add the listed imports.\n\nMake sure to add `part 'database.g.dart';` beneath the imports of this file.\nIt's important to note that 'database' has to get exchanged with the filename of the database definition.\nIn this case, the file is named `database.dart`.\n\n```dart\n\u002F\u002F database.dart\n\n\u002F\u002F required package imports\nimport 'dart:async';\nimport 'package:floor\u002Ffloor.dart';\nimport 'package:sqflite\u002Fsqflite.dart' as sqflite;\n\nimport 'dao\u002Fperson_dao.dart';\nimport 'entity\u002Fperson.dart';\n\npart 'database.g.dart'; \u002F\u002F the generated code will be there\n\n@Database(version: 1, entities: [Person])\nabstract class AppDatabase extends FloorDatabase {\n  PersonDao get personDao;\n}\n```\n\n### 5. Run the Code Generator\n\nRun the generator with `flutter packages pub run build_runner build`.\nTo automatically run it, whenever a file changes, use `flutter packages pub run build_runner watch`.\n\n### 6. Use the Generated Code\n\nFor obtaining an instance of the database, use the generated `$FloorAppDatabase` class, which allows access to a database builder.\nThe name is being composed by `$Floor` and the database class name.\nThe string passed to `databaseBuilder()` will be the database file name.\nFor initializing the database, call `build()` and make sure to `await` the result.\n\nIn order to retrieve the `PersonDao` instance, invoking the `persoDao` getter on the database instance is enough.\nIts functions can be used as shown in the following snippet.\n\n```dart\nfinal database = await $FloorAppDatabase.databaseBuilder('app_database.db').build();\n\nfinal personDao = database.personDao;\nfinal person = Person(1, 'Frank');\n\nawait personDao.insertPerson(person);\nfinal result = await personDao.findPersonById(1);\n```\n\nFor further examples take a look at the [example](https:\u002F\u002Fgithub.com\u002Fpinchbv\u002Ffloor\u002Ftree\u002Fdevelop\u002Fexample) and [test](https:\u002F\u002Fgithub.com\u002Fpinchbv\u002Ffloor\u002Ftree\u002Fdevelop\u002Ffloor\u002Ftest\u002Fintegration) directories.\n\n## Naming\nThe library's name derives from the following.\n*Floor* as the *bottom layer* of a [Room](https:\u002F\u002Fdeveloper.android.com\u002Ftopic\u002Flibraries\u002Farchitecture\u002Froom) which points to the analogy of the database layer being the bottom and foundation layer of most applications.\nWhere *fl* also gives a pointer that the library is used in the Flutter context.\n\n## Bugs, Ideas, and Feedback\nFor bugs please use [GitHub Issues](https:\u002F\u002Fgithub.com\u002Fpinchbv\u002Ffloor\u002Fissues).\nFor questions, ideas, and discussions use [GitHub Discussions](https:\u002F\u002Fgithub.com\u002Fpinchbv\u002Ffloor\u002Fdiscussions).\n\n## License\n    Copyright 2023 The Floor Project Authors\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n    http:\u002F\u002Fwww.apache.org\u002Flicenses\u002FLICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n","Floor 是一个为 Flutter 应用程序设计的类型安全、响应式且轻量级的 SQLite 抽象库。它提供了内存对象与数据库行之间的自动映射，同时允许开发者通过 SQL 语句完全控制数据库操作，这要求使用者具备一定的 SQL 和 SQLite 知识。Floor 的核心特性包括空安全、类型安全、响应式编程支持以及以 SQL 为中心的设计原则，确保了透明度和无隐藏成本。该库适用于需要高效、可靠本地数据存储方案的跨平台 Flutter 项目，支持 iOS、Android 以及多种桌面操作系统。",2,"2026-06-11 03:23:01","top_language"]