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:
```yaml
dependencies:
moor_flutter:
git:
url: https://github.com/simolus3/moor.git
path: moor/
moor_flutter: ^1.0.0
dev_dependencies:
moor_generator:
git:
url: https://github.com/simolus3/moor.git
path: moor_generator/
moor_generator: ^1.0.0
build_runner: ^1.2.0
```
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:
```yaml
dependencies:
moor_flutter:
git:
url: https://github.com/simolus3/moor.git
path: moor/
moor_flutter: ^1.0.0
dev_dependencies:
moor_generator:
git:
url: https://github.com/simolus3/moor.git
path: moor_generator/
moor_generator: ^1.0.0
build_runner: ^1.2.0
```
We're going to use the `moor_flutter` library to specify tables and access the database. The

View File

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

View File

@ -9,7 +9,7 @@ typedef Widget RemovedItemBuilder<T>(
BuildContext context, T item, Animation<double> anim);
/// 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 ItemBuilder<T> itemBuilder;
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).
final bool Function(T a, T b) equals;
moorAnimatedList(
MoorAnimatedList(
{@required this.stream,
@required this.itemBuilder,
@required this.removedItemBuilder,
this.equals});
@override
_moorAnimatedListState<T> createState() {
return _moorAnimatedListState<T>();
_MoorAnimatedListState<T> createState() {
return _MoorAnimatedListState<T>();
}
}
class _moorAnimatedListState<T> extends State<moorAnimatedList<T>> {
class _MoorAnimatedListState<T> extends State<MoorAnimatedList<T>> {
List<T> _lastSnapshot;
int _initialItemCount;
@ -95,7 +95,7 @@ class _moorAnimatedListState<T> extends State<moorAnimatedList<T>> {
}
@override
void didUpdateWidget(moorAnimatedList<T> oldWidget) {
void didUpdateWidget(MoorAnimatedList<T> oldWidget) {
_subscription?.cancel();
_lastSnapshot = null;
_setupSubscription();

View File

@ -1,6 +1,6 @@
name: moor_flutter
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
authors:
- Simon Binder <simolus3@gmail.com>