mirror of https://github.com/AMT-Cheif/drift.git
Fix ugly typo, remove git dependency from readme
This commit is contained in:
parent
bfe1cb8017
commit
087ecc9860
10
README.md
10
README.md
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue