floor_generator 0.12.0

  • Readme
  • Changelog
  • Installing
  • 88

Floor #

A supportive SQLite abstraction for your Flutter applications (iOS, Android and macOS)

This is the dev dependency and contains the annotation processor. Please refer to the floor package on pub or visit Github for more information.


The library's name derives from the following. Floor as the bottom layer of a Room which points to the analogy of the database layer being the bottom and foundation layer of most applications. Where fl also gives a pointer that the library is used in the Flutter context.

Bugs and Feedback #

For bugs, questions and discussions please use Github Issues. For general communication use floor's Slack.

License #

Copyright 2019 Vitus Ortner

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Changelog #

0.12.0 #

Changes #

  • Ignore Getters&Setters
  • Use Flutter bundled pub to get and upgrade project dependencies
  • Generate database implementation on every CI run
  • Throw exception when querying for unsupported type
  • Add generated code for example app
  • Add workflow scripts
  • Run real database tests on development machine and CI

🚀 Features #

  • Support ByteArrays/Blobs
  • Support inherited fields for entities and views
  • Support database views
  • Support inherited DAO methods
  • Support asynchronous migrations

🐛 Bug Fixes #

  • Fix failing SQLite installation process on CI
  • Fix failing stream query test

0.11.0 #

Changes #

  • Refactor string utility function into extension function
  • Refactor annotation check functions to use extension functions
  • Refactor type check functions to use extension functions

🚀 Features #

  • Ignore fields of entities by adding ignore annotation
  • Handle named constructor parameters and ignore field order
  • Exclude static fields from entity mapping

0.10.0 #

Changes #

  • Update dependencies
  • Update README with correct instructions to initialize in memory database

🐛 Bug Fixes #

  • Make in-memory database actually be just in memory

0.9.0 #

🐛 Bug Fixes #

  • Make IN clauses work with strings
  • Fix foreign key action string representation

0.8.0 #

Changes #

  • Update README with clear package import instructions

🚀 Features #

  • Introduce static 'to map' functions
  • Add optional callback functions when opening database

🐛 Bug Fixes #

  • Allow int and string (composite) primary keys

0.7.0 #

🐛 Bug Fixes #

  • Retain reactivity when using transactions

0.6.0 #

🚀 Features #

  • Add support for IN clauses in query statements
  • Enable compound primary keys

0.5.0 #

Changes #

  • Make tasks deletable in example app

🚀 Features #

  • Allow multiline string queries
  • Allow void-return queries with arguments

0.4.2 #

🐛 Bug Fixes #

  • Fix query parameter substitution regex

0.4.0 #

Changes #

  • Enable coverage report
  • Simplify type assertions and add tests

🚀 Features #

  • Allow more convenient database initialization

🐛 Bug Fixes #

  • Use query argument binding instead of manual binding

0.3.0 #

Changes #

  • Use TypeChecker for all annotations
  • Add publishing instructions
  • Remove unused annotation names
  • Simplify the mapping from an entity to a map
  • Fix database writer test
  • Make stream emit query result on subscription
  • Update example to use StreamBuilder
  • Update README

🐛 Bug Fixes #

  • Correct mapper instance name referenced by generated query methods
  • Fix adapter instances naming

0.2.0 #

Changes #

  • Add database adapters
  • Run floor Flutter tests
  • Move value objects to value_objects directory
  • Map source elements into value objects in processors
  • Use GeneratorForAnnotation and TypeChecker to verify annotations
  • Throw more specific errors on obfuscated database annotation

🚀 Features #

  • Add support for migrations
  • Add support for returning Streams as query result
  • Support accessing data from Data Access Objects
  • Add entity classes to database annotation
  • Add support for indices

0.1.0 #

🚀 Features #

  • Support conflict strategies when inserting and updating records
  • Add support for running queries that return void
  • Add support for foreign keys
  • Add parameter verification for query methods
  • Return deleted row count on delete
  • Return updated rows count on update
  • Return ID/s of inserted item/s
  • Add support for transactions
  • Add support for changing (insert, update, delete) lists
  • Support custom entity name
  • Enable NOT NULL columns
  • Enable custom column name mapping
  • Add delete methods code generation and fix update methods
  • Add update methods code generation
  • Add insert methods code generation
  • Add code generator for query methods
  • Code generation for database creation

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  floor_generator: ^0.12.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:floor_generator/builder.dart';
import 'package:floor_generator/generator.dart';
import 'package:floor_generator/misc/annotation_expression.dart';
import 'package:floor_generator/misc/annotations.dart';
import 'package:floor_generator/misc/change_method_processor_helper.dart';
import 'package:floor_generator/misc/change_method_writer_helper.dart';
import 'package:floor_generator/misc/constants.dart';
import 'package:floor_generator/misc/foreign_key_action.dart';
import 'package:floor_generator/misc/string_utils.dart';
import 'package:floor_generator/misc/type_utils.dart';
import 'package:floor_generator/processor/dao_processor.dart';
import 'package:floor_generator/processor/database_processor.dart';
import 'package:floor_generator/processor/deletion_method_processor.dart';
import 'package:floor_generator/processor/entity_processor.dart';
import 'package:floor_generator/processor/error/database_processor_error.dart';
import 'package:floor_generator/processor/error/entity_processor_error.dart';
import 'package:floor_generator/processor/error/query_method_processor_error.dart';
import 'package:floor_generator/processor/error/queryable_processor_error.dart';
import 'package:floor_generator/processor/error/view_processor_error.dart';
import 'package:floor_generator/processor/field_processor.dart';
import 'package:floor_generator/processor/insertion_method_processor.dart';
import 'package:floor_generator/processor/processor.dart';
import 'package:floor_generator/processor/query_method_processor.dart';
import 'package:floor_generator/processor/queryable_processor.dart';
import 'package:floor_generator/processor/transaction_method_processor.dart';
import 'package:floor_generator/processor/update_method_processor.dart';
import 'package:floor_generator/processor/view_processor.dart';
import 'package:floor_generator/value_object/change_method.dart';
import 'package:floor_generator/value_object/dao.dart';
import 'package:floor_generator/value_object/dao_getter.dart';
import 'package:floor_generator/value_object/database.dart';
import 'package:floor_generator/value_object/deletion_method.dart';
import 'package:floor_generator/value_object/entity.dart';
import 'package:floor_generator/value_object/field.dart';
import 'package:floor_generator/value_object/foreign_key.dart';
import 'package:floor_generator/value_object/index.dart';
import 'package:floor_generator/value_object/insertion_method.dart';
import 'package:floor_generator/value_object/primary_key.dart';
import 'package:floor_generator/value_object/query_method.dart';
import 'package:floor_generator/value_object/queryable.dart';
import 'package:floor_generator/value_object/transaction_method.dart';
import 'package:floor_generator/value_object/update_method.dart';
import 'package:floor_generator/value_object/view.dart';
import 'package:floor_generator/writer/dao_writer.dart';
import 'package:floor_generator/writer/database_builder_writer.dart';
import 'package:floor_generator/writer/database_writer.dart';
import 'package:floor_generator/writer/deletion_method_writer.dart';
import 'package:floor_generator/writer/floor_writer.dart';
import 'package:floor_generator/writer/insertion_method_writer.dart';
import 'package:floor_generator/writer/query_method_writer.dart';
import 'package:floor_generator/writer/transaction_method_writer.dart';
import 'package:floor_generator/writer/update_method_writer.dart';
import 'package:floor_generator/writer/writer.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
80
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
88
Learn more about scoring.

We analyzed this package on Mar 28, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6

Maintenance suggestions

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and floor_generator.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.6.0 <3.0.0
analyzer ^0.39.4 0.39.4
build ^1.2.2 1.2.2
build_config ^0.4.1+1 0.4.2
code_builder ^3.2.1 3.2.1
collection ^1.14.11 1.14.12
floor_annotation ^0.7.0 0.7.0
meta ^1.1.8 1.1.8
source_gen ^0.9.4+7 0.9.5
Transitive dependencies
_fe_analyzer_shared 1.0.3
args 1.6.0
async 2.4.1
built_collection 4.3.2
built_value 7.0.9
charcode 1.1.3
checked_yaml 1.0.2
convert 2.1.1
crypto 2.1.4
csslib 0.16.1
fixnum 0.10.11
glob 1.2.0
html 0.14.0+3
js 0.6.1+1
json_annotation 3.0.1
logging 0.11.4
matcher 0.12.6
node_interop 1.0.3
node_io 1.0.1+2
package_config 1.9.3
pedantic 1.9.0
pub_semver 1.4.4
pubspec_parse 0.1.5
quiver 2.1.3
source_span 1.7.0
stack_trace 1.9.3
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
watcher 0.9.7+14
yaml 2.2.0
Dev dependencies
build_test ^0.10.12
dart_style ^1.3.3 1.3.3
mockito ^4.1.1
path ^1.6.4 1.6.4
test ^1.11.0
test_cov ^0.2.1