Changed constructor implementation of the firestore provider to avoid name conflicts. Firebase plugins no longer throw whe performing operations
This commit is contained in:
parent
6fd93a59a7
commit
f1226aea99
2 changed files with 7 additions and 13 deletions
|
|
@ -5,7 +5,7 @@ import './models/task_model.dart';
|
||||||
import './models/user_model.dart';
|
import './models/user_model.dart';
|
||||||
import './resources/firestore_provider.dart';
|
import './resources/firestore_provider.dart';
|
||||||
|
|
||||||
class App extends StatelessWidget {
|
/* class App extends StatelessWidget {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
title: 'Do more',
|
title: 'Do more',
|
||||||
|
|
@ -18,9 +18,9 @@ class App extends StatelessWidget {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
} */
|
||||||
|
|
||||||
/* class App extends StatelessWidget {
|
class App extends StatelessWidget {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final fire = FirestoreProvider();
|
final fire = FirestoreProvider();
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
|
|
@ -64,7 +64,7 @@ class App extends StatelessWidget {
|
||||||
fire.updateEvent(
|
fire.updateEvent(
|
||||||
'vBOvtmTeC8iPg8L4Hixh',
|
'vBOvtmTeC8iPg8L4Hixh',
|
||||||
'-LZReccofbHpw9UfOTMk',
|
'-LZReccofbHpw9UfOTMk',
|
||||||
name: 'kjhahslkdjhf',
|
name: 'Custom Task',
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: Text('Add task'),
|
child: Text('Add task'),
|
||||||
|
|
@ -86,4 +86,4 @@ class App extends StatelessWidget {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} */
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,20 +5,14 @@ import '../models/event_model.dart';
|
||||||
import '../models/user_model.dart';
|
import '../models/user_model.dart';
|
||||||
import '../models/task_model.dart';
|
import '../models/task_model.dart';
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO: the cloud firestore plugin currently throws an error when calling
|
|
||||||
* methods that modify documents. Wait for a fix.
|
|
||||||
* https://github.com/flutter/flutter/issues/28103
|
|
||||||
*/
|
|
||||||
|
|
||||||
/// A connection to the Cloud Firestore database
|
/// A connection to the Cloud Firestore database
|
||||||
///
|
///
|
||||||
/// Implempents CRUD operations for users, tasks and events.
|
/// Implempents CRUD operations for users, tasks and events.
|
||||||
class FirestoreProvider {
|
class FirestoreProvider {
|
||||||
final Firestore firestore;
|
final Firestore firestore;
|
||||||
|
|
||||||
FirestoreProvider([Firestore firestore])
|
FirestoreProvider([Firestore injectedFirestore])
|
||||||
: this.firestore = firestore ?? Firestore.instance {
|
: firestore = injectedFirestore ?? Firestore.instance {
|
||||||
firestore.settings(timestampsInSnapshotsEnabled: true);
|
firestore.settings(timestampsInSnapshotsEnabled: true);
|
||||||
}
|
}
|
||||||
//-----------------------User related operations------------------------------
|
//-----------------------User related operations------------------------------
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue