Implement == and hashCode in generated data classes

This commit is contained in:
Simon Binder 2019-02-10 11:21:04 +01:00
parent 05f020e7fe
commit 14ea7c36e0
15 changed files with 391 additions and 311 deletions

View File

@ -5,28 +5,27 @@
<entry key="analyzer">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/analyzer-0.34.3/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-0.34.3/lib" />
</list>
</value>
</entry>
<entry key="analyzer_plugin">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/analyzer_plugin-0.0.1-alpha.6/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer_plugin-0.0.1-alpha.6/lib" />
</list>
</value>
</entry>
<entry key="args">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/args-1.5.1/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/args-1.5.1/lib" />
</list>
</value>
</entry>
<entry key="async">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/async-2.0.8/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/async-2.0.8/lib" />
</list>
</value>
@ -34,7 +33,6 @@
<entry key="boolean_selector">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/boolean_selector-1.0.4/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/boolean_selector-1.0.4/lib" />
</list>
</value>
@ -42,77 +40,69 @@
<entry key="build">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/build-1.1.0/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/build-1.1.0/lib" />
</list>
</value>
</entry>
<entry key="build_config">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/build_config-0.3.1+4/lib" />
</list>
</value>
</entry>
<entry key="build_daemon">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/build_daemon-0.2.3/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/build_config-0.3.1+4/lib" />
</list>
</value>
</entry>
<entry key="build_resolvers">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/build_resolvers-0.2.3/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/build_resolvers-0.2.3/lib" />
</list>
</value>
</entry>
<entry key="build_runner">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/build_runner-1.2.3/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/build_runner-1.1.3/lib" />
</list>
</value>
</entry>
<entry key="build_runner_core">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/build_runner_core-2.0.1/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/build_runner_core-1.1.3/lib" />
</list>
</value>
</entry>
<entry key="build_test">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/build_test-0.10.6/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/build_test-0.10.6/lib" />
</list>
</value>
</entry>
<entry key="built_collection">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/built_collection-4.1.0/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/built_collection-4.1.0/lib" />
</list>
</value>
</entry>
<entry key="built_value">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/built_value-6.3.0/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/built_value-6.3.0/lib" />
</list>
</value>
</entry>
<entry key="built_value_generator">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/built_value_generator-6.3.0/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/built_value_generator-6.3.0/lib" />
</list>
</value>
</entry>
<entry key="charcode">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/charcode-1.1.2/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/charcode-1.1.2/lib" />
</list>
</value>
@ -120,14 +110,13 @@
<entry key="code_builder">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/code_builder-3.2.0/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/code_builder-3.2.0/lib" />
</list>
</value>
</entry>
<entry key="collection">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/collection-1.14.11/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/collection-1.14.11/lib" />
</list>
</value>
@ -135,35 +124,35 @@
<entry key="convert">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/convert-2.1.1/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/convert-2.1.1/lib" />
</list>
</value>
</entry>
<entry key="crypto">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/crypto-2.0.6/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/crypto-2.0.6/lib" />
</list>
</value>
</entry>
<entry key="csslib">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/csslib-0.14.6/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/csslib-0.14.6/lib" />
</list>
</value>
</entry>
<entry key="dart_style">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/dart_style-1.2.3/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/dart_style-1.2.3/lib" />
</list>
</value>
</entry>
<entry key="fixnum">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/fixnum-0.10.9/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/fixnum-0.10.9/lib" />
</list>
</value>
</entry>
@ -184,98 +173,97 @@
<entry key="front_end">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/front_end-0.1.9+1/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/front_end-0.1.9+1/lib" />
</list>
</value>
</entry>
<entry key="glob">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/glob-1.1.7/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/glob-1.1.7/lib" />
</list>
</value>
</entry>
<entry key="graphs">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/graphs-0.2.0/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/graphs-0.2.0/lib" />
</list>
</value>
</entry>
<entry key="html">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/html-0.13.3+3/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/html-0.13.3+3/lib" />
</list>
</value>
</entry>
<entry key="http">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/http-0.12.0+1/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.12.0+1/lib" />
</list>
</value>
</entry>
<entry key="http_multi_server">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/http_multi_server-2.0.5/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/http_multi_server-2.0.5/lib" />
</list>
</value>
</entry>
<entry key="http_parser">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/http_parser-3.1.3/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/http_parser-3.1.3/lib" />
</list>
</value>
</entry>
<entry key="io">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/io-0.3.3/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/io-0.3.3/lib" />
</list>
</value>
</entry>
<entry key="js">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/js-0.6.1+1/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/js-0.6.1+1/lib" />
</list>
</value>
</entry>
<entry key="json_annotation">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/json_annotation-2.0.0/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/json_annotation-2.0.0/lib" />
</list>
</value>
</entry>
<entry key="json_rpc_2">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/json_rpc_2-2.0.9/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/json_rpc_2-2.0.9/lib" />
</list>
</value>
</entry>
<entry key="kernel">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/kernel-0.3.9+1/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/kernel-0.3.9+1/lib" />
</list>
</value>
</entry>
<entry key="logging">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/logging-0.11.3+2/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/logging-0.11.3+2/lib" />
</list>
</value>
</entry>
<entry key="matcher">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/matcher-0.12.3+1/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/matcher-0.12.3+1/lib" />
</list>
</value>
@ -283,7 +271,6 @@
<entry key="meta">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/meta-1.1.7/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/meta-1.1.6/lib" />
</list>
</value>
@ -291,7 +278,7 @@
<entry key="mime">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/mime-0.9.6+2/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/mime-0.9.6+2/lib" />
</list>
</value>
</entry>
@ -305,35 +292,34 @@
<entry key="multi_server_socket">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/multi_server_socket-1.0.2/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/multi_server_socket-1.0.2/lib" />
</list>
</value>
</entry>
<entry key="node_preamble">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/node_preamble-1.4.4/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/node_preamble-1.4.4/lib" />
</list>
</value>
</entry>
<entry key="package_config">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/package_config-1.0.5/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/package_config-1.0.5/lib" />
</list>
</value>
</entry>
<entry key="package_resolver">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/package_resolver-1.0.6/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/package_resolver-1.0.6/lib" />
</list>
</value>
</entry>
<entry key="path">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/path-1.6.2/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/path-1.6.2/lib" />
</list>
</value>
@ -341,42 +327,41 @@
<entry key="pedantic">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/pedantic-1.4.0/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/pedantic-1.4.0/lib" />
</list>
</value>
</entry>
<entry key="plugin">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/plugin-0.2.0+3/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/plugin-0.2.0+3/lib" />
</list>
</value>
</entry>
<entry key="pool">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/pool-1.4.0/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/pool-1.4.0/lib" />
</list>
</value>
</entry>
<entry key="pub_semver">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/pub_semver-1.4.2/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/pub_semver-1.4.2/lib" />
</list>
</value>
</entry>
<entry key="pubspec_parse">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/pubspec_parse-0.1.4/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/pubspec_parse-0.1.4/lib" />
</list>
</value>
</entry>
<entry key="quiver">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/quiver-2.0.1/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/quiver-2.0.1/lib" />
</list>
</value>
@ -384,35 +369,35 @@
<entry key="recase">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/recase-2.0.1/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/recase-2.0.1/lib" />
</list>
</value>
</entry>
<entry key="shelf">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/shelf-0.7.4/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/shelf-0.7.4/lib" />
</list>
</value>
</entry>
<entry key="shelf_packages_handler">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/shelf_packages_handler-1.0.4/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/shelf_packages_handler-1.0.4/lib" />
</list>
</value>
</entry>
<entry key="shelf_static">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/shelf_static-0.2.8/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/shelf_static-0.2.8/lib" />
</list>
</value>
</entry>
<entry key="shelf_web_socket">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/shelf_web_socket-0.2.2+4/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/shelf_web_socket-0.2.2+4/lib" />
</list>
</value>
</entry>
@ -426,28 +411,28 @@
<entry key="source_gen">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/source_gen-0.9.4+1/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/source_gen-0.9.4+1/lib" />
</list>
</value>
</entry>
<entry key="source_map_stack_trace">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/source_map_stack_trace-1.1.5/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/source_map_stack_trace-1.1.5/lib" />
</list>
</value>
</entry>
<entry key="source_maps">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/source_maps-0.10.8/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/source_maps-0.10.8/lib" />
</list>
</value>
</entry>
<entry key="source_span">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/source_span-1.5.4/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/source_span-1.5.4/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/source_span-1.4.1/lib" />
</list>
</value>
@ -462,7 +447,6 @@
<entry key="stack_trace">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/stack_trace-1.9.3/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/stack_trace-1.9.3/lib" />
</list>
</value>
@ -470,7 +454,6 @@
<entry key="stream_channel">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/stream_channel-1.6.8/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/stream_channel-1.6.8/lib" />
</list>
</value>
@ -478,14 +461,13 @@
<entry key="stream_transform">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/stream_transform-0.0.14+1/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/stream_transform-0.0.14+1/lib" />
</list>
</value>
</entry>
<entry key="string_scanner">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/string_scanner-1.0.4/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/string_scanner-1.0.4/lib" />
</list>
</value>
@ -500,7 +482,7 @@
<entry key="term_glyph">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/term_glyph-1.1.0/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/term_glyph-1.1.0/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/term_glyph-1.0.1/lib" />
</list>
</value>
@ -508,14 +490,13 @@
<entry key="test">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/test-1.5.3/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/test-1.5.1+1/lib" />
</list>
</value>
</entry>
<entry key="test_api">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/test_api-0.2.2/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/test_api-0.2.1/lib" />
</list>
</value>
@ -523,21 +504,20 @@
<entry key="test_core">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/test_core-0.2.1+1/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/test_core-0.2.0+1/lib" />
</list>
</value>
</entry>
<entry key="timing">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/timing-0.1.1+1/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/timing-0.1.1+1/lib" />
</list>
</value>
</entry>
<entry key="typed_data">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/typed_data-1.1.6/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/typed_data-1.1.6/lib" />
</list>
</value>
@ -545,7 +525,7 @@
<entry key="utf">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/utf-0.9.0+5/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/utf-0.9.0+5/lib" />
</list>
</value>
</entry>
@ -559,127 +539,113 @@
<entry key="vm_service_client">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/vm_service_client-0.2.6/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/vm_service_client-0.2.6/lib" />
</list>
</value>
</entry>
<entry key="watcher">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/watcher-0.9.7+10/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/watcher-0.9.7+10/lib" />
</list>
</value>
</entry>
<entry key="web_socket_channel">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/web_socket_channel-1.0.9/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/web_socket_channel-1.0.9/lib" />
</list>
</value>
</entry>
<entry key="yaml">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/yaml-2.1.15/lib" />
<option value="$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/yaml-2.1.15/lib" />
</list>
</value>
</entry>
</option>
</properties>
<CLASSES>
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/analyzer-0.34.3/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/analyzer_plugin-0.0.1-alpha.6/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/args-1.5.1/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/async-2.0.8/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/boolean_selector-1.0.4/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/build-1.1.0/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/build_config-0.3.1+4/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/build_daemon-0.2.3/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/build_resolvers-0.2.3/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/build_runner-1.2.3/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/build_runner_core-2.0.1/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/build_test-0.10.6/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/built_collection-4.1.0/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/built_value-6.3.0/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/built_value_generator-6.3.0/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/charcode-1.1.2/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/code_builder-3.2.0/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/collection-1.14.11/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/convert-2.1.1/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/crypto-2.0.6/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/csslib-0.14.6/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/dart_style-1.2.3/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/fixnum-0.10.9/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/front_end-0.1.9+1/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/glob-1.1.7/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/graphs-0.2.0/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/html-0.13.3+3/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/http-0.12.0+1/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/http_multi_server-2.0.5/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/http_parser-3.1.3/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/io-0.3.3/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/js-0.6.1+1/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/json_annotation-2.0.0/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/json_rpc_2-2.0.9/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/kernel-0.3.9+1/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/logging-0.11.3+2/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/matcher-0.12.3+1/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/meta-1.1.7/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/mime-0.9.6+2/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/multi_server_socket-1.0.2/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/node_preamble-1.4.4/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/package_config-1.0.5/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/package_resolver-1.0.6/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/path-1.6.2/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/pedantic-1.4.0/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/plugin-0.2.0+3/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/pool-1.4.0/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/pub_semver-1.4.2/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/pubspec_parse-0.1.4/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/quiver-2.0.1/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/recase-2.0.1/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/shelf-0.7.4/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/shelf_packages_handler-1.0.4/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/shelf_static-0.2.8/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/shelf_web_socket-0.2.2+4/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/source_gen-0.9.4+1/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/source_map_stack_trace-1.1.5/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/source_maps-0.10.8/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/source_span-1.5.4/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/stack_trace-1.9.3/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/stream_channel-1.6.8/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/stream_transform-0.0.14+1/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/string_scanner-1.0.4/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/term_glyph-1.1.0/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/test-1.5.3/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/test_api-0.2.2/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/test_core-0.2.1+1/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/timing-0.1.1+1/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/typed_data-1.1.6/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/utf-0.9.0+5/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/vm_service_client-0.2.6/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/watcher-0.9.7+10/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/web_socket_channel-1.0.9/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/yaml-2.1.15/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-0.34.3/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer_plugin-0.0.1-alpha.6/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/args-1.5.1/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/async-2.0.8/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/boolean_selector-1.0.4/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/build-1.1.0/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/build_config-0.3.1+4/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/build_resolvers-0.2.3/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/build_runner-1.1.3/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/build_runner_core-1.1.3/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/build_test-0.10.6/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/built_collection-4.1.0/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/built_value-6.3.0/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/built_value_generator-6.3.0/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/charcode-1.1.2/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/code_builder-3.2.0/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/collection-1.14.11/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/convert-2.1.1/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/crypto-2.0.6/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/csslib-0.14.6/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/dart_style-1.2.3/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/fixnum-0.10.9/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/front_end-0.1.9+1/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/glob-1.1.7/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/graphs-0.2.0/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/html-0.13.3+3/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.12.0+1/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/http_multi_server-2.0.5/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/http_parser-3.1.3/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/io-0.3.3/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/js-0.6.1+1/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/json_annotation-2.0.0/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/json_rpc_2-2.0.9/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/kernel-0.3.9+1/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/logging-0.11.3+2/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/matcher-0.12.3+1/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/meta-1.1.6/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/mime-0.9.6+2/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/mockito-4.0.0/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/multi_server_socket-1.0.2/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/node_preamble-1.4.4/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/package_config-1.0.5/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/package_resolver-1.0.6/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/path-1.6.2/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/pedantic-1.4.0/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/plugin-0.2.0+3/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/pool-1.4.0/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/pub_semver-1.4.2/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/pubspec_parse-0.1.4/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/quiver-2.0.1/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/recase-2.0.1/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/shelf-0.7.4/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/shelf_packages_handler-1.0.4/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/shelf_static-0.2.8/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/shelf_web_socket-0.2.2+4/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/source_gen-0.9.4+1/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/source_map_stack_trace-1.1.5/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/source_maps-0.10.8/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/source_span-1.4.1/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/source_span-1.5.4/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.1.0/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/stack_trace-1.9.3/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/stream_channel-1.6.8/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/stream_transform-0.0.14+1/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/string_scanner-1.0.4/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/synchronized-1.5.3+2/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/term_glyph-1.0.1/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/term_glyph-1.1.0/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/test-1.5.1+1/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/test_api-0.2.1/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/test_core-0.2.0+1/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/timing-0.1.1+1/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/typed_data-1.1.6/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/utf-0.9.0+5/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/vector_math-2.0.8/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/vm_service_client-0.2.6/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/watcher-0.9.7+10/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/web_socket_channel-1.0.9/lib" />
<root url="file://$USER_HOME$/Android/flutter/.pub-cache/hosted/pub.dartlang.org/yaml-2.1.15/lib" />
<root url="file://$USER_HOME$/Android/flutter/bin/cache/pkg/sky_engine/lib" />
<root url="file://$USER_HOME$/Android/flutter/packages/flutter/lib" />
<root url="file://$USER_HOME$/Android/flutter/packages/flutter_test/lib" />

127
README.md
View File

@ -1,127 +0,0 @@
# Sally
[![Build Status](https://travis-ci.com/simolus3/sally.svg?token=u4VnFEE5xnWVvkE6QsqL&branch=master)](https://travis-ci.com/simolus3/sally)
Sally is an easy to use and safe way to persist data for Flutter apps. It features
a fluent Dart DSL to describe tables and will generate matching database code that
can be used to easily read and store your app's data.
__Note:__ This library is in development and not yet available for general use on `pub`.
## Using this library
#### Adding the dependency
First, let's add sally to your prooject's `pubspec.yaml`:
```yaml
dependencies:
sally:
git:
url:
path: sally/
dev_dependencies:
sally_generator:
git:
url:
path: sally_generator/
build_runner:
```
We're going to use the `sally` library to specify tables and write data. The
`sally_generator` library will take care of generating the necessary code so the
library knows how your table structure looks like.
#### Declaring tables
You can use the DSL included with this library to specify your libraries with simple
dart code:
```dart
import 'package:sally/sally.dart';
// assuming that your file is called filename.dart. This will give an error at first,
// but it's needed for sally to know about the generated code
part 'filename.g.dart';
class Todos extends Table {
IntColumn get id => integer().autoIncrement()();
TextColumn get name => text().withLength(min: 6, max: 10)();
TextColumn get content => text().named('body')();
IntColumn get category => integer()();
}
class Categories extends Table {
@override
String get tableName => 'todo_categories';
IntColumn get id => integer().autoIncrement()();
TextColumn get description => text()();
}
@UseSally(tables: [Todos, Categories])
class MyDatabase {
}
```
__⚠ Warning:__ Even though it might look like it, the content of a `Table` class does not support full Dart code. It can only
be used to declare the table name, it's primary keys and columns. The code inside of a table class will never be
executed. Instead, the generator will take a look at your table classes to figure out how their structure looks like.
This won't work if the body of your tables is not constant. This should not be problem, but please be aware of this.
#### Generating the code
Sally integrates with the dart `build` system, so you can generate all the code needed with
`flutter packages pub run build_runner build`. If you want to continously rebuild the code
whever you change your code, run `flutter packages pub run build_runner watch` instead.
After running either command once, sally generator will have created a class for your
database and data classes for your entities. To use it, change the `MyDatabase` class as
follows:
```dart
@UseSally(tables: [Todos, Categories])
class MyDatabase extends _$MyDatabase {
@override
int get schemaVersion => 1;
@override
MigrationStrategy get migration => MigrationStrategy();
}
```
You can ignore these two getters there at the moment, the imporant part is that you can
now run your queries with fluent Dart code:
```dart
class MyDatabase extends _$MyDatabase {
// .. the getters that have been defined above still need to be here
Future<List<Todo>> get allTodoEntries => select(todos).get();
Future<void> deleteCategory(Category toDelete) async {
await (delete(todos)..where((entry) => entry.category.equalsVal(category.id))).go();
await (delete(categories)..where((cat) => cat.id.equalsVal(toDelete.id))).go();
}
}
```
## TODO-List
If you have suggestions for new features or any other questions, feel free to
create an issue.
##### Before this library can be released
- Insert and update statements
- Custom primary keys
- Stabilize all end-user APIs
- Support default values and expressions, auto-increment
- Implement `==` and `hashCode` in data classes
- Allow custom table names for the generated dart types
##### Definitely planned for the future
- Allow using DAOs instead of having to put everything in the main database
class.
- Auto-updating streams
- Support more Datatypes: We should at least support `DateTime` and `Uint8List`,
supporting floating point numbers as well would be awesome
- Nullable / non-nullable datatypes
- DSL API
- Support in generator
- Use in queries (`IS NOT NULL`)
- Verify constraints (text length, nullability, etc.) before inserting or
deleting data.
- Support Dart VM apps
- References
- Table joins
##### Interesting stuff that would be nice to have
- `GROUP BY` grouping functions
- Support for different database engines
- Support webapps via `AlaSQL` or a different engine

1
README.md Symbolic link
View File

@ -0,0 +1 @@
sally/README.md

1
example/.flutter-plugins Normal file
View File

@ -0,0 +1 @@
sqflite=/home/simon/Android/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.1.0/

View File

@ -0,0 +1,25 @@
package io.flutter.plugins;
import io.flutter.plugin.common.PluginRegistry;
import com.tekartik.sqflite.SqflitePlugin;
/**
* Generated file. Do not edit.
*/
public final class GeneratedPluginRegistrant {
public static void registerWith(PluginRegistry registry) {
if (alreadyRegisteredWith(registry)) {
return;
}
SqflitePlugin.registerWith(registry.registrarFor("com.tekartik.sqflite.SqflitePlugin"));
}
private static boolean alreadyRegisteredWith(PluginRegistry registry) {
final String key = GeneratedPluginRegistrant.class.getCanonicalName();
if (registry.hasPlugin(key)) {
return true;
}
registry.registrarFor(key);
return false;
}
}

View File

@ -0,0 +1,14 @@
//
// Generated file. Do not edit.
//
#ifndef GeneratedPluginRegistrant_h
#define GeneratedPluginRegistrant_h
#import <Flutter/Flutter.h>
@interface GeneratedPluginRegistrant : NSObject
+ (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry;
@end
#endif /* GeneratedPluginRegistrant_h */

View File

@ -0,0 +1,14 @@
//
// Generated file. Do not edit.
//
#import "GeneratedPluginRegistrant.h"
#import <sqflite/SqflitePlugin.h>
@implementation GeneratedPluginRegistrant
+ (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry {
[SqflitePlugin registerWithRegistrar:[registry registrarForPlugin:@"SqflitePlugin"]];
}
@end

View File

@ -10,6 +10,12 @@ class Product {
final int id;
final String name;
Product({this.id, this.name});
@override
int get hashCode => (id.hashCode) * 31 + name.hashCode;
@override
bool operator ==(other) =>
identical(this, other) ||
(other is Product && other.id == id && other.name == name);
}
class _$ProductsTable extends Products implements TableInfo<Products, Product> {
@ -42,6 +48,12 @@ class User {
final int id;
final String name;
User({this.id, this.name});
@override
int get hashCode => (id.hashCode) * 31 + name.hashCode;
@override
bool operator ==(other) =>
identical(this, other) ||
(other is User && other.id == id && other.name == name);
}
class _$UsersTable extends Users implements TableInfo<Users, User> {
@ -75,6 +87,16 @@ class Todo {
final String name;
final String content;
Todo({this.id, this.name, this.content});
@override
int get hashCode =>
((id.hashCode) * 31 + name.hashCode) * 31 + content.hashCode;
@override
bool operator ==(other) =>
identical(this, other) ||
(other is Todo &&
other.id == id &&
other.name == name &&
other.content == content);
}
class _$TodosTable extends Todos implements TableInfo<Todos, Todo> {
@ -85,7 +107,7 @@ class _$TodosTable extends Todos implements TableInfo<Todos, Todo> {
@override
GeneratedTextColumn get name => GeneratedTextColumn('name', false);
@override
GeneratedTextColumn get content => GeneratedTextColumn('content', false);
GeneratedTextColumn get content => GeneratedTextColumn('body', false);
@override
List<GeneratedColumn> get $columns => [id, name, content];
@override
@ -101,7 +123,7 @@ class _$TodosTable extends Todos implements TableInfo<Todos, Todo> {
return Todo(
id: intType.mapFromDatabaseResponse(data['id']),
name: stringType.mapFromDatabaseResponse(data['name']),
content: stringType.mapFromDatabaseResponse(data['content']),
content: stringType.mapFromDatabaseResponse(data['body']),
);
}
}

View File

@ -5,7 +5,7 @@ description: A sample command-line application.
# author: simon <email@example.com>
environment:
sdk: '>=2.1.0 <3.0.0'
sdk: '>=2.0.0 <3.0.0'
dependencies:
sally:

3
sally/.gitignore vendored
View File

@ -25,6 +25,9 @@ doc/api/
*.js.deps
*.js.map
android/
ios/
### Intellij ###
.idea/**/*
# End of https://www.gitignore.io/api/dart,intellij

View File

@ -1,22 +1,126 @@
A library for Dart developers.
# Sally
[![Build Status](https://travis-ci.com/simolus3/sally.svg?token=u4VnFEE5xnWVvkE6QsqL&branch=master)](https://travis-ci.com/simolus3/sally)
Created from templates made available by Stagehand under a BSD-style
[license](https://github.com/dart-lang/stagehand/blob/master/LICENSE).
Sally is an easy to use and safe way to persist data for Flutter apps. It features
a fluent Dart DSL to describe tables and will generate matching database code that
can be used to easily read and store your app's data.
## Usage
__Note:__ This library is in development and not yet available for general use on `pub`.
A simple usage example:
## Using this library
#### Adding the dependency
First, let's add sally to your prooject's `pubspec.yaml`:
```yaml
dependencies:
sally:
git:
url:
path: sally/
dev_dependencies:
sally_generator:
git:
url:
path: sally_generator/
build_runner:
```
We're going to use the `sally` library to specify tables and write data. The
`sally_generator` library will take care of generating the necessary code so the
library knows how your table structure looks like.
#### Declaring tables
You can use the DSL included with this library to specify your libraries with simple
dart code:
```dart
import 'package:sally/sally.dart';
main() {
var awesome = new Awesome();
// assuming that your file is called filename.dart. This will give an error at first,
// but it's needed for sally to know about the generated code
part 'filename.g.dart';
class Todos extends Table {
IntColumn get id => integer().autoIncrement()();
TextColumn get name => text().withLength(min: 6, max: 10)();
TextColumn get content => text().named('body')();
IntColumn get category => integer()();
}
class Categories extends Table {
@override
String get tableName => 'todo_categories';
IntColumn get id => integer().autoIncrement()();
TextColumn get description => text()();
}
@UseSally(tables: [Todos, Categories])
class MyDatabase {
}
```
## Features and bugs
__⚠ Warning:__ Even though it might look like it, the content of a `Table` class does not support full Dart code. It can only
be used to declare the table name, it's primary keys and columns. The code inside of a table class will never be
executed. Instead, the generator will take a look at your table classes to figure out how their structure looks like.
This won't work if the body of your tables is not constant. This should not be problem, but please be aware of this.
Please file feature requests and bugs at the [issue tracker][tracker].
#### Generating the code
Sally integrates with the dart `build` system, so you can generate all the code needed with
`flutter packages pub run build_runner build`. If you want to continously rebuild the code
whever you change your code, run `flutter packages pub run build_runner watch` instead.
After running either command once, sally generator will have created a class for your
database and data classes for your entities. To use it, change the `MyDatabase` class as
follows:
```dart
@UseSally(tables: [Todos, Categories])
class MyDatabase extends _$MyDatabase {
@override
int get schemaVersion => 1;
@override
MigrationStrategy get migration => MigrationStrategy();
}
```
You can ignore these two getters there at the moment, the imporant part is that you can
now run your queries with fluent Dart code:
```dart
class MyDatabase extends _$MyDatabase {
// .. the getters that have been defined above still need to be here
[tracker]: http://example.com/issues/replaceme
Future<List<Todo>> get allTodoEntries => select(todos).get();
Future<void> deleteCategory(Category toDelete) async {
await (delete(todos)..where((entry) => entry.category.equalsVal(category.id))).go();
await (delete(categories)..where((cat) => cat.id.equalsVal(toDelete.id))).go();
}
}
```
## TODO-List
If you have suggestions for new features or any other questions, feel free to
create an issue.
##### Before this library can be released
- Insert and update statements
- Custom primary keys
- Stabilize all end-user APIs
- Support default values and expressions, auto-increment
- Allow custom table names for the generated dart types
##### Definitely planned for the future
- Allow using DAOs instead of having to put everything in the main database
class.
- Auto-updating streams
- Support more Datatypes: We should at least support `DateTime` and `Uint8List`,
supporting floating point numbers as well would be awesome
- Nullable / non-nullable datatypes
- DSL API
- Support in generator
- Use in queries (`IS NOT NULL`)
- Verify constraints (text length, nullability, etc.) before inserting or
deleting data.
- Support Dart VM apps
- References
- Table joins
##### Interesting stuff that would be nice to have
- `GROUP BY` grouping functions
- Support for different database engines
- Support webapps via `AlaSQL` or a different engine

View File

@ -0,0 +1 @@
sqflite=/home/simon/Android/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.1.0/

View File

@ -25,6 +25,9 @@ doc/api/
*.js.deps
*.js.map
android/
ios/
### Intellij ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

View File

@ -0,0 +1,67 @@
import 'package:sally_generator/src/model/specified_table.dart';
class DataClassWriter {
final SpecifiedTable table;
DataClassWriter(this.table);
void writeInto(StringBuffer buffer) {
buffer.write('class ${table.dartTypeName} {\n');
// write individual fields
for (var column in table.columns) {
buffer.write('final ${column.dartTypeName} ${column.dartGetterName}; \n');
}
// write constructor with named optional fields
buffer
..write(table.dartTypeName)
..write('({')
..write(table.columns
.map((column) => 'this.${column.dartGetterName}')
.join(', '))
..write('});')
..write('@override\n int get hashCode => ');
if (table.columns.isEmpty) {
buffer.write('identityHashCode(this); \n');
} else {
final fields = table.columns.map((c) => c.dartGetterName).toList();
buffer..write(_calculateHashCode(fields))..write('; \n');
}
// override ==
// return identical(this, other) || (other is Todo && other.id == id && other.)
buffer
..write('@override\nbool operator ==(other) => ')
..write('identical(this, other) || (other is ${table.dartTypeName}');
if (table.columns.isNotEmpty) {
buffer
..write('&&')
..write(table.columns.map((c) {
final getter = c.dartGetterName;
return 'other.$getter == $getter';
}).join(' && '));
}
// finish overrides method and class declaration
buffer.write(');\n}');
}
/// Recursively creates the implementation for hashCode of the data class,
/// assuming it has at least one field. When it has one field, we just return
/// the hash code of that field. Otherwise, we multiply it with 31 and add
/// the hash code of the next field, and so on.
String _calculateHashCode(List<String> fields) {
if (fields.length == 1) {
return '${fields.last}.hashCode';
} else {
final last = fields.removeLast();
final innerHash = _calculateHashCode(fields);
return '($innerHash) * 31 + $last.hashCode';
}
}
}

View File

@ -1,5 +1,6 @@
import 'package:recase/recase.dart';
import 'package:sally_generator/src/model/specified_table.dart';
import 'package:sally_generator/src/writer/data_class_writer.dart';
class TableWriter {
final SpecifiedTable table;
@ -12,22 +13,7 @@ class TableWriter {
}
void writeDataClass(StringBuffer buffer) {
buffer.write('class ${table.dartTypeName} {\n');
// write individual fields
for (var column in table.columns) {
buffer.write('final ${column.dartTypeName} ${column.dartGetterName}; \n');
}
// write constructor with named optional fields
buffer
..write(table.dartTypeName)
..write('({')
..write(table.columns
.map((column) => 'this.${column.dartGetterName}')
.join(', '))
..write('});')
..write('\n}');
DataClassWriter(table).writeInto(buffer);
}
void writeTableInfoClass(StringBuffer buffer) {

View File

@ -5,7 +5,7 @@ description: A starting point for Dart libraries or applications.
# author: Simon Binder <email@example.com>
environment:
sdk: '>=2.1.0 <3.0.0'
sdk: '>=2.0.0 <3.0.0'
dependencies:
analyzer: '< 0.35.0'