diff --git a/packages/cloud_firestore/CHANGELOG.md b/packages/cloud_firestore/CHANGELOG.md index 09a5cd81433b..9229b38d8f8d 100644 --- a/packages/cloud_firestore/CHANGELOG.md +++ b/packages/cloud_firestore/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.9.7+2 + +* Bump the minimum Flutter version to 1.2.0. +* Add template type parameter to `invokeMethod` calls. + ## 0.9.7+1 * Update README with example of getting a document. diff --git a/packages/cloud_firestore/lib/src/document_reference.dart b/packages/cloud_firestore/lib/src/document_reference.dart index 62f95252af7d..7f103d3fd769 100644 --- a/packages/cloud_firestore/lib/src/document_reference.dart +++ b/packages/cloud_firestore/lib/src/document_reference.dart @@ -40,10 +40,7 @@ class DocumentReference { /// If [merge] is true, the provided data will be merged into an /// existing document instead of overwriting. Future setData(Map data, {bool merge = false}) { - // TODO(amirh): remove this on when the invokeMethod update makes it to stable Flutter. - // https://github.com/flutter/flutter/issues/26431 - // ignore: strong_mode_implicit_dynamic_method - return Firestore.channel.invokeMethod( + return Firestore.channel.invokeMethod( 'DocumentReference#setData', { 'app': firestore.app.name, @@ -61,10 +58,7 @@ class DocumentReference { /// /// If no document exists yet, the update will fail. Future updateData(Map data) { - // TODO(amirh): remove this on when the invokeMethod update makes it to stable Flutter. - // https://github.com/flutter/flutter/issues/26431 - // ignore: strong_mode_implicit_dynamic_method - return Firestore.channel.invokeMethod( + return Firestore.channel.invokeMethod( 'DocumentReference#updateData', { 'app': firestore.app.name, @@ -78,10 +72,8 @@ class DocumentReference { /// /// If no document exists, the read will return null. Future get() async { - // TODO(amirh): remove this on when the invokeMethod update makes it to stable Flutter. - // https://github.com/flutter/flutter/issues/26431 - // ignore: strong_mode_implicit_dynamic_method - final Map data = await Firestore.channel.invokeMethod( + final Map data = + await Firestore.channel.invokeMapMethod( 'DocumentReference#get', {'app': firestore.app.name, 'path': path}, ); @@ -94,10 +86,7 @@ class DocumentReference { /// Deletes the document referred to by this [DocumentReference]. Future delete() { - // TODO(amirh): remove this on when the invokeMethod update makes it to stable Flutter. - // https://github.com/flutter/flutter/issues/26431 - // ignore: strong_mode_implicit_dynamic_method - return Firestore.channel.invokeMethod( + return Firestore.channel.invokeMethod( 'DocumentReference#delete', {'app': firestore.app.name, 'path': path}, ); @@ -120,10 +109,7 @@ class DocumentReference { StreamController controller; // ignore: close_sinks controller = StreamController.broadcast( onListen: () { - // TODO(amirh): remove this on when the invokeMethod update makes it to stable Flutter. - // https://github.com/flutter/flutter/issues/26431 - // ignore: strong_mode_implicit_dynamic_method - _handle = Firestore.channel.invokeMethod( + _handle = Firestore.channel.invokeMethod( 'Query#addDocumentListener', { 'app': firestore.app.name, @@ -136,10 +122,7 @@ class DocumentReference { }, onCancel: () { _handle.then((int handle) async { - // TODO(amirh): remove this on when the invokeMethod update makes it to stable Flutter. - // https://github.com/flutter/flutter/issues/26431 - // ignore: strong_mode_implicit_dynamic_method - await Firestore.channel.invokeMethod( + await Firestore.channel.invokeMethod( 'Query#removeListener', {'handle': handle}, ); diff --git a/packages/cloud_firestore/lib/src/firestore.dart b/packages/cloud_firestore/lib/src/firestore.dart index 42639d140bfe..27c90ff599e8 100644 --- a/packages/cloud_firestore/lib/src/firestore.dart +++ b/packages/cloud_firestore/lib/src/firestore.dart @@ -110,25 +110,21 @@ class Firestore { 'Transaction timeout must be more than 0 milliseconds'); final int transactionId = _transactionHandlerId++; _transactionHandlers[transactionId] = transactionHandler; - final Map result = await channel - // TODO(amirh): remove this on when the invokeMethod update makes it to stable Flutter. - // https://github.com/flutter/flutter/issues/26431 - // ignore: strong_mode_implicit_dynamic_method - .invokeMethod('Firestore#runTransaction', { + final Map result = await channel + .invokeMapMethod( + 'Firestore#runTransaction', { 'app': app.name, 'transactionId': transactionId, 'transactionTimeout': timeout.inMilliseconds }); - return result?.cast() ?? {}; + return result ?? {}; } @deprecated Future enablePersistence(bool enable) async { assert(enable != null); - // TODO(amirh): remove this on when the invokeMethod update makes it to stable Flutter. - // https://github.com/flutter/flutter/issues/26431 - // ignore: strong_mode_implicit_dynamic_method - await channel.invokeMethod('Firestore#enablePersistence', { + await channel + .invokeMethod('Firestore#enablePersistence', { 'app': app.name, 'enable': enable, }); @@ -139,10 +135,7 @@ class Firestore { String host, bool sslEnabled, bool timestampsInSnapshotsEnabled}) async { - // TODO(amirh): remove this on when the invokeMethod update makes it to stable Flutter. - // https://github.com/flutter/flutter/issues/26431 - // ignore: strong_mode_implicit_dynamic_method - await channel.invokeMethod('Firestore#settings', { + await channel.invokeMethod('Firestore#settings', { 'app': app.name, 'persistenceEnabled': persistenceEnabled, 'host': host, diff --git a/packages/cloud_firestore/lib/src/query.dart b/packages/cloud_firestore/lib/src/query.dart index a23809852a86..dc35082a87fc 100644 --- a/packages/cloud_firestore/lib/src/query.dart +++ b/packages/cloud_firestore/lib/src/query.dart @@ -53,10 +53,7 @@ class Query { StreamController controller; // ignore: close_sinks controller = StreamController.broadcast( onListen: () { - // TODO(amirh): remove this on when the invokeMethod update makes it to stable Flutter. - // https://github.com/flutter/flutter/issues/26431 - // ignore: strong_mode_implicit_dynamic_method - _handle = Firestore.channel.invokeMethod( + _handle = Firestore.channel.invokeMethod( 'Query#addSnapshotListener', { 'app': firestore.app.name, @@ -70,10 +67,7 @@ class Query { }, onCancel: () { _handle.then((int handle) async { - // TODO(amirh): remove this on when the invokeMethod update makes it to stable Flutter. - // https://github.com/flutter/flutter/issues/26431 - // ignore: strong_mode_implicit_dynamic_method - await Firestore.channel.invokeMethod( + await Firestore.channel.invokeMethod( 'Query#removeListener', {'handle': handle}, ); @@ -86,10 +80,8 @@ class Query { /// Fetch the documents for this query Future getDocuments() async { - // TODO(amirh): remove this on when the invokeMethod update makes it to stable Flutter. - // https://github.com/flutter/flutter/issues/26431 - // ignore: strong_mode_implicit_dynamic_method - final Map data = await Firestore.channel.invokeMethod( + final Map data = + await Firestore.channel.invokeMapMethod( 'Query#getDocuments', { 'app': firestore.app.name, diff --git a/packages/cloud_firestore/lib/src/transaction.dart b/packages/cloud_firestore/lib/src/transaction.dart index 734c942f53fe..f6f80c6b2d71 100644 --- a/packages/cloud_firestore/lib/src/transaction.dart +++ b/packages/cloud_firestore/lib/src/transaction.dart @@ -14,11 +14,8 @@ class Transaction { Firestore _firestore; Future get(DocumentReference documentReference) async { - final dynamic result = await Firestore.channel - // TODO(amirh): remove this on when the invokeMethod update makes it to stable Flutter. - // https://github.com/flutter/flutter/issues/26431 - // ignore: strong_mode_implicit_dynamic_method - .invokeMethod('Transaction#get', { + final Map result = await Firestore.channel + .invokeMapMethod('Transaction#get', { 'app': _firestore.app.name, 'transactionId': _transactionId, 'path': documentReference.path, @@ -33,10 +30,7 @@ class Transaction { Future delete(DocumentReference documentReference) async { return Firestore.channel - // TODO(amirh): remove this on when the invokeMethod update makes it to stable Flutter. - // https://github.com/flutter/flutter/issues/26431 - // ignore: strong_mode_implicit_dynamic_method - .invokeMethod('Transaction#delete', { + .invokeMethod('Transaction#delete', { 'app': _firestore.app.name, 'transactionId': _transactionId, 'path': documentReference.path, @@ -46,10 +40,7 @@ class Transaction { Future update( DocumentReference documentReference, Map data) async { return Firestore.channel - // TODO(amirh): remove this on when the invokeMethod update makes it to stable Flutter. - // https://github.com/flutter/flutter/issues/26431 - // ignore: strong_mode_implicit_dynamic_method - .invokeMethod('Transaction#update', { + .invokeMethod('Transaction#update', { 'app': _firestore.app.name, 'transactionId': _transactionId, 'path': documentReference.path, @@ -59,10 +50,8 @@ class Transaction { Future set( DocumentReference documentReference, Map data) async { - // TODO(amirh): remove this on when the invokeMethod update makes it to stable Flutter. - // https://github.com/flutter/flutter/issues/26431 - // ignore: strong_mode_implicit_dynamic_method - return Firestore.channel.invokeMethod('Transaction#set', { + return Firestore.channel + .invokeMethod('Transaction#set', { 'app': _firestore.app.name, 'transactionId': _transactionId, 'path': documentReference.path, diff --git a/packages/cloud_firestore/lib/src/write_batch.dart b/packages/cloud_firestore/lib/src/write_batch.dart index cfa5e5253357..6a41ee7bfec3 100644 --- a/packages/cloud_firestore/lib/src/write_batch.dart +++ b/packages/cloud_firestore/lib/src/write_batch.dart @@ -12,10 +12,7 @@ part of cloud_firestore; /// nor can it be committed again. class WriteBatch { WriteBatch._(this._firestore) - // TODO(amirh): remove this on when the invokeMethod update makes it to stable Flutter. - // https://github.com/flutter/flutter/issues/26431 - // ignore: strong_mode_implicit_dynamic_method - : _handle = Firestore.channel.invokeMethod( + : _handle = Firestore.channel.invokeMethod( 'WriteBatch#create', {'app': _firestore.app.name}); final Firestore _firestore; @@ -32,10 +29,7 @@ class WriteBatch { if (!_committed) { _committed = true; await Future.wait(_actions); - // TODO(amirh): remove this on when the invokeMethod update makes it to stable Flutter. - // https://github.com/flutter/flutter/issues/26431 - // ignore: strong_mode_implicit_dynamic_method - await Firestore.channel.invokeMethod( + await Firestore.channel.invokeMethod( 'WriteBatch#commit', {'handle': await _handle}); } else { throw StateError("This batch has already been committed."); @@ -47,10 +41,7 @@ class WriteBatch { if (!_committed) { _handle.then((dynamic handle) { _actions.add( - // TODO(amirh): remove this on when the invokeMethod update makes it to stable Flutter. - // https://github.com/flutter/flutter/issues/26431 - // ignore: strong_mode_implicit_dynamic_method - Firestore.channel.invokeMethod( + Firestore.channel.invokeMethod( 'WriteBatch#delete', { 'app': _firestore.app.name, @@ -77,10 +68,7 @@ class WriteBatch { if (!_committed) { _handle.then((dynamic handle) { _actions.add( - // TODO(amirh): remove this on when the invokeMethod update makes it to stable Flutter. - // https://github.com/flutter/flutter/issues/26431 - // ignore: strong_mode_implicit_dynamic_method - Firestore.channel.invokeMethod( + Firestore.channel.invokeMethod( 'WriteBatch#setData', { 'app': _firestore.app.name, @@ -105,10 +93,7 @@ class WriteBatch { if (!_committed) { _handle.then((dynamic handle) { _actions.add( - // TODO(amirh): remove this on when the invokeMethod update makes it to stable Flutter. - // https://github.com/flutter/flutter/issues/26431 - // ignore: strong_mode_implicit_dynamic_method - Firestore.channel.invokeMethod( + Firestore.channel.invokeMethod( 'WriteBatch#updateData', { 'app': _firestore.app.name, diff --git a/packages/cloud_firestore/pubspec.yaml b/packages/cloud_firestore/pubspec.yaml index 1e3c4d6a00b4..1781a59dddb3 100755 --- a/packages/cloud_firestore/pubspec.yaml +++ b/packages/cloud_firestore/pubspec.yaml @@ -3,7 +3,7 @@ description: Flutter plugin for Cloud Firestore, a cloud-hosted, noSQL database live synchronization and offline support on Android and iOS. author: Flutter Team homepage: https://github.com/flutter/plugins/tree/master/packages/cloud_firestore -version: 0.9.7+1 +version: 0.9.7+2 flutter: plugin: @@ -27,4 +27,4 @@ dev_dependencies: environment: sdk: ">=2.0.0-dev.28.0 <3.0.0" - flutter: ">=0.2.4 <2.0.0" + flutter: ">=1.2.0 <2.0.0"