Fix ugly typo, remove git dependency from readme

This commit is contained in:
Simon Binder 2019-03-09 21:18:50 +01:00
parent bfe1cb8017
commit 087ecc9860
No known key found for this signature in database
GPG Key ID: B807FDF954BA00CF
5 changed files with 29 additions and 46 deletions

View File

@ -31,16 +31,10 @@ First, let's add moor to your project's `pubspec.yaml`. The library is not yet
out on pub, so you'll need to use the git repository for now: out on pub, so you'll need to use the git repository for now:
```yaml ```yaml
dependencies: dependencies:
moor_flutter: moor_flutter: ^1.0.0
git:
url: https://github.com/simolus3/moor.git
path: moor/
dev_dependencies: dev_dependencies:
moor_generator: moor_generator: ^1.0.0
git:
url: https://github.com/simolus3/moor.git
path: moor_generator/
build_runner: ^1.2.0 build_runner: ^1.2.0
``` ```
We're going to use the `moor_flutter` library to specify tables and access the database. The We're going to use the `moor_flutter` library to specify tables and access the database. The

View File

@ -31,16 +31,10 @@ First, let's add moor to your project's `pubspec.yaml`. The library is not yet
out on pub, so you'll need to use the git repository for now: out on pub, so you'll need to use the git repository for now:
```yaml ```yaml
dependencies: dependencies:
moor_flutter: moor_flutter: ^1.0.0
git:
url: https://github.com/simolus3/moor.git
path: moor/
dev_dependencies: dev_dependencies:
moor_generator: moor_generator: ^1.0.0
git:
url: https://github.com/simolus3/moor.git
path: moor_generator/
build_runner: ^1.2.0 build_runner: ^1.2.0
``` ```
We're going to use the `moor_flutter` library to specify tables and access the database. The We're going to use the `moor_flutter` library to specify tables and access the database. The

View File

@ -43,21 +43,17 @@ class FlutterQueryExecutor extends QueryExecutor {
resolvedPath = path; resolvedPath = path;
} }
_db = await openDatabase( _db = await openDatabase(resolvedPath, version: databaseInfo.schemaVersion,
resolvedPath,
version: databaseInfo.schemaVersion,
onCreate: (db, version) { onCreate: (db, version) {
_hadMigration = true; _hadMigration = true;
return databaseInfo.handleDatabaseCreation( return databaseInfo.handleDatabaseCreation(
executor: (sql) => db.execute(sql), executor: (sql) => db.execute(sql),
); );
}, }, onUpgrade: (db, from, to) {
onUpgrade: (db, from, to) {
_hadMigration = true; _hadMigration = true;
return databaseInfo.handleDatabaseVersionChange( return databaseInfo.handleDatabaseVersionChange(
executor: (sql) => db.execute(sql), from: from, to: to); executor: (sql) => db.execute(sql), from: from, to: to);
}, }, onOpen: (db) async {
onOpen: (db) async {
_db = db; _db = db;
// the openDatabase future will resolve later, so we can get an instance // the openDatabase future will resolve later, so we can get an instance
// where we can send the queries from the onFinished operation; // where we can send the queries from the onFinished operation;
@ -65,8 +61,7 @@ class FlutterQueryExecutor extends QueryExecutor {
if (fn != null && _hadMigration) { if (fn != null && _hadMigration) {
await fn(); await fn();
} }
} });
);
return true; return true;
} }

View File

@ -9,7 +9,7 @@ typedef Widget RemovedItemBuilder<T>(
BuildContext context, T item, Animation<double> anim); BuildContext context, T item, Animation<double> anim);
/// An [AnimatedList] that shows the result of a moor query stream. /// An [AnimatedList] that shows the result of a moor query stream.
class moorAnimatedList<T> extends StatefulWidget { class MoorAnimatedList<T> extends StatefulWidget {
final Stream<List<T>> stream; final Stream<List<T>> stream;
final ItemBuilder<T> itemBuilder; final ItemBuilder<T> itemBuilder;
final RemovedItemBuilder<T> removedItemBuilder; final RemovedItemBuilder<T> removedItemBuilder;
@ -20,19 +20,19 @@ class moorAnimatedList<T> extends StatefulWidget {
/// one text and not let the item disappear to show up again). /// one text and not let the item disappear to show up again).
final bool Function(T a, T b) equals; final bool Function(T a, T b) equals;
moorAnimatedList( MoorAnimatedList(
{@required this.stream, {@required this.stream,
@required this.itemBuilder, @required this.itemBuilder,
@required this.removedItemBuilder, @required this.removedItemBuilder,
this.equals}); this.equals});
@override @override
_moorAnimatedListState<T> createState() { _MoorAnimatedListState<T> createState() {
return _moorAnimatedListState<T>(); return _MoorAnimatedListState<T>();
} }
} }
class _moorAnimatedListState<T> extends State<moorAnimatedList<T>> { class _MoorAnimatedListState<T> extends State<MoorAnimatedList<T>> {
List<T> _lastSnapshot; List<T> _lastSnapshot;
int _initialItemCount; int _initialItemCount;
@ -95,7 +95,7 @@ class _moorAnimatedListState<T> extends State<moorAnimatedList<T>> {
} }
@override @override
void didUpdateWidget(moorAnimatedList<T> oldWidget) { void didUpdateWidget(MoorAnimatedList<T> oldWidget) {
_subscription?.cancel(); _subscription?.cancel();
_lastSnapshot = null; _lastSnapshot = null;
_setupSubscription(); _setupSubscription();

View File

@ -1,6 +1,6 @@
name: moor_flutter name: moor_flutter
description: Flutter implementation of moor, a safe and reactive persistence library for Dart applications description: Flutter implementation of moor, a safe and reactive persistence library for Dart applications
version: 1.0.0 version: 1.0.1
homepage: https://github.com/simolus3/moor homepage: https://github.com/simolus3/moor
authors: authors:
- Simon Binder <simolus3@gmail.com> - Simon Binder <simolus3@gmail.com>