Posts

Showing posts with the label google-cloud-firestore

Flutter Firestore NoSuchMethodError

I'm developing app with flutter and trying to get data from firestore by using streambuilder method like so. body: new StreamBuilder<DocumentSnapshot>( stream: Firestore.instance.collection('user').document(uid).collection('userInfo').document(uid).snapshots(), builder: (BuildContext context, AsyncSnapshot<DocumentSnapshot> snapshot) { if (snapshot.connectionState == ConnectionState.waiting) return new Center(child: new CircularProgressIndicator()); if (snapshot.hasData) { return new Center( child: ListView( shrinkWrap: true, padding: EdgeInsets.only(left: 24.0, right: 24.0), children: <Widget>[ new Column( children: <Widget>[ new CircleAvatar( backgroundColor: Colors.transparent, radius: 48.0, child: Image.asset('assets/logo.png'), ), new Padd...

Dismissing AlertDialog in Flutter

I have simple Flutter app with list of items that are loaded from Firebase database (Cloud Firestore). As you can see - there is button for adding items and each item can be deleted or edited. When I press edit button for selected item, AlertDialog with TextField appears, in this TextField user can see current item name and edit it. I have problems only with dismissing dialog after editing. new IconButton( icon: new Icon(Icons.edit, color: Colors.white), onPressed: (){ showItemUpdateDialog(context, document); } ) ....... void showItemUpdateDialog(BuildContext context, DocumentSnapshot item) { String itemName = ""; var textContoller = new TextEditingController(); textContoller.text = item['name']; var dialog = new AlertDialog( title: new Text("item name"), content: new TextField( controller: textContoller, onChanged: (value) {newName = value;}, ), actions: <Widget>[ new FlatButton( ...

cloud_furestore and firebase_auth compatiblity issue in Flutter

I am developing a Flutter app. My app works fine with cloud_firestore and firebase_auth packages when I use them separately. However, when I include both of them together in my pubspecs.yaml file, the build fails and the following message is shown: Note: /home/saber/Code/mobile_dev/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.7.4/android/src/main/java/io/flutter/plugins/firebase/cloudfirestore/CloudFirestorePlugin.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. Note: /home/saber/Code/mobile_dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.5.18/android/src/main/java/io/flutter/plugins/firebaseauth/FirebaseAuthPlugin.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: /home/saber/Code/mobile_dev/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.5.18/android/src/main/java/io/flutter/plugins/firebaseauth/FirebaseAuthPlugin.java uses unchecked or unsafe operati...

Flutter Map error

I want to build an App using Flutter and Firebase (Firestore version cloud_firestore: ^0.6.3). When loading a Collection from Firestore using StreamBuilder to display it in a ListView I get an error saying: The following assertion was thrown building StreamBuilder(dirty, state: I/flutter (26287): _StreamBuilderBaseState>#d5638): I/flutter (26287): type '_InternalLinkedHashMap' is not a subtype of type 'Map' I/flutter (26287): where I/flutter (26287): _InternalLinkedHashMap is from dart:collection I/flutter (26287): Map is from dart:core I/flutter (26287): String is from dart:core I/flutter (26287): And I can't get my head around because even when removing the lines the use the DocumentSnapshots it throws the error. This is how I want to acces the filed in the Snapshots. Creator.fromDoc(DocumentSnapshot doc) { this.creatorId = doc['creatorId']; this.name = doc['name']; } Or Creator.fromMap(doc.data); Creator.fromMap(Map<String, dy...