Skip to content

Snappy1

  • Home
  • Android
  • What
  • How
  • Is
  • Can
  • Does
  • Do
  • Why
  • Are
  • Who
  • Toggle search form

[FIXED] Flutter: Firestore Transaction Crashes Android emulation

Posted on November 11, 2022 By

Solution 1 :

This might be hard. You did not mention version of Android Studio and which android device and os version have you run. I suggest to try install another virtual device and check. Here you have nice tutorial for Mac.

If this will not work there is a page for troubleshooting emulator if you do not find your issue there you can report a bug.

Good luck!

Problem :

I am trying to run a transaction with firestore that will increment a vote counter.
I am running the following code:

Firestore.instance.runTransaction((Transaction tx) async {
          DocumentSnapshot postSnapshot = await tx.get(postRef);
          if (postSnapshot.exists) {
            //print(postSnapshot.data['Votes']);
            await tx.update(postRef, <String, dynamic>{'Votes': postSnapshot.data['Votes'] + 1})
          .catchError((e) {print(e);});
          }
        }).catchError((e) {
          print(e);
        });

Sometimes, this works fine, but sometimes it causes my android emulator to crash silently – the app closes and the console says Lost connection to device. Neither of the catchError statements prints, and there is no output from the console. Flutter doctor reports no issues. This does not seem to be an issue on iOS, although it is hard to tell since the error is sporadic.
My version of flutter is Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.15.2 19C57, locale en-US)

Does anyone know why this might be happening? Is it an issue with flutter or with the way I’m running the transaction? Any help would be greatly appreciated, thanks!

Comments

Comment posted by gollyzoom

I am using Android Studio 3.5, I am emulating on a Pixel 2 with android 9.0, and API 28.

READ  [FIXED] java - Firebase (Realtime Database) Multiple Queries
Powered by Inline Related Posts
Android Tags:android, dart, flutter, google-cloud-firestore, transactions

Post navigation

Previous Post: [FIXED] activity_main.xml for android studio stuck on loading
Next Post: Can a beginner learn Moonlight Sonata 1st Movement?

Related Posts

[FIXED] android – Best searching library for mobile database Android
[FIXED] java – line breaks in string resource Android
[FIXED] android – Declaring transparency-varied colour primary in XML without explicitly declaring each colour resource Android
[FIXED] java – I can’t add items to HashMap after querying them from firebase android Android
[FIXED] android – How to draw rectangle in onBindViewHolder for RecyclerAdapter? Android
[FIXED] firebase cloud messaging – Android 10 Incoming call notification like whats app when we are in another app Android

Archives

  • March 2023
  • February 2023
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022

Categories

  • ¿Cómo
  • ¿Cuál
  • ¿Cuándo
  • ¿Cuántas
  • ¿Cuánto
  • ¿Qué
  • Android
  • Are
  • At
  • C'est
  • Can
  • Comment
  • Did
  • Do
  • Does
  • Est-ce
  • Est-il
  • For
  • Has
  • Hat
  • How
  • In
  • Is
  • Ist
  • Kann
  • Où
  • Pourquoi
  • Quand
  • Quel
  • Quelle
  • Quelles
  • Quels
  • Qui
  • Should
  • Sind
  • Sollte
  • Uncategorized
  • Wann
  • Warum
  • Was
  • Welche
  • Welchen
  • Welcher
  • Welches
  • Were
  • What
  • What's
  • When
  • Where
  • Which
  • Who
  • Who's
  • Why
  • Wie
  • Will
  • Wird
  • Wo
  • Woher
  • you can create a selvedge edge: You can make the edges of garter stitch more smooth by slipping the first stitch of every row.2022-02-04
  • you really only need to know two patterns: garter stitch

Recent Posts

  • What is a good substitute for condensed milk?
  • ¿Como el cuerpo te avisa cuando te va a dar un infarto?
  • What is the luxury brand of Jaguar?
  • Who is Big poppa baseball player?
  • What material are foam runners?

Recent Comments

No comments to show.

Copyright © 2023 Snappy1.

Powered by PressBook Grid Dark theme