firebase / flutterfire

πŸ”₯ A collection of Firebase plugins for Flutter apps.
https://firebase.google.com/docs/flutter/setup
BSD 3-Clause "New" or "Revised" License
8.63k stars 3.95k forks source link

[cloud_firestore] Stream is empty when on iOS but not Android #4267

Closed sgalway00 closed 3 years ago

sgalway00 commented 3 years ago

Bug report

I can successfully read and write to a cloud firestore database from within my flutter app. However, when running on an iOS simulator (or real device) I cannot listen to a stream for realtime changes to a document. No errors or exceptions are thrown when listening to the stream. The stream exists, it just doesn't have data in it. This problem DOES NOT exist when running on an Android emulator.

Steps to reproduce

final athletePos = Provider<GPSPoint>((ref) {
  GPSPoint _curPos;

  print('athletePos is active');

  Stream _docStream = FirebaseFirestore.instance.collection('Athlete1').doc('currentPosition').snapshots();

  if (_docStream.isBroadcast == true) {
    print('Stream is broadcasting');
  }

  _docStream.listen((event) {
    print('athletePos stream event received');
    _curPos = GPSPoint.fromFSMap(event.data());
  });

  return _curPos;
});

Expected behavior

Expect both print statements to fire. On iOS only "Stream is broadcasting" will fire. On Android, both will fire.


Flutter doctor


[βœ“] Flutter (Channel beta, 1.24.0-10.2.pre, on Mac OS X 10.15.7 19H15 darwin-x64, locale en-US)
    β€’ Flutter version 1.24.0-10.2.pre at /Users/sgalway/development/flutter
    β€’ Framework revision 022b333a08 (11 days ago), 2020-11-18 11:35:09 -0800
    β€’ Engine revision 07c1eed46b
    β€’ Dart version 2.12.0 (build 2.12.0-29.10.beta)

[βœ“] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    β€’ Android SDK at /Users/sgalway/Library/Android/sdk
    β€’ Platform android-29, build-tools 29.0.2
    β€’ Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    β€’ Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    β€’ All Android licenses accepted.

[βœ“] Xcode - develop for iOS and macOS (Xcode 12.2)
    β€’ Xcode at /Applications/Xcode.app/Contents/Developer
    β€’ Xcode 12.2, Build version 12B45b
    β€’ CocoaPods version 1.10.0

[βœ“] Chrome - develop for the web
    β€’ Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[βœ“] Android Studio (version 4.0)
    β€’ Android Studio at /Applications/Android Studio.app/Contents
    β€’ Flutter plugin version 48.1.2
    β€’ Dart plugin version 193.7361
    β€’ Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[βœ“] IntelliJ IDEA Community Edition (version 2020.1.2)
    β€’ IntelliJ at /Applications/IntelliJ IDEA CE.app
    β€’ Flutter plugin version 47.1.3
    β€’ Dart plugin version 201.7846.93

[βœ“] VS Code (version 1.51.1)
    β€’ VS Code at /Applications/Visual Studio Code.app/Contents
    β€’ Flutter extension version 3.16.0

[βœ“] Connected device (3 available)
    β€’ iPhone 11 Pro (mobile) β€’ 21B0C3BA-D8B9-4AF2-81A5-FC8176E49F24 β€’ ios            β€’
      com.apple.CoreSimulator.SimRuntime.iOS-14-2 (simulator)
    β€’ Web Server (web)       β€’ web-server                           β€’ web-javascript β€’ Flutter Tools
    β€’ Chrome (web)           β€’ chrome                               β€’ web-javascript β€’ Google Chrome 86.0.4240.198

β€’ No issues found!

Flutter dependencies

Run flutter pub deps -- --style=compact and paste the output below:

Click To Expand ``` Dart SDK 2.12.0-29.10.beta Flutter SDK 1.24.0-10.2.pre yonav2 0.0.1+1 |-- auto_size_text 2.1.0 | '-- flutter... |-- background_locator 1.2.2+1 | '-- flutter... |-- battery 1.0.7 | |-- battery_platform_interface 1.0.0 | | |-- flutter... | | |-- meta... | | '-- plugin_platform_interface... | |-- flutter... | '-- meta... |-- bloc 4.0.0 | '-- meta... |-- build_runner 1.10.6 | |-- args... | |-- async... | |-- build... | |-- build_config 0.4.3 | | |-- checked_yaml 1.0.2 | | | |-- json_annotation... | | | |-- source_span... | | | '-- yaml... | | |-- json_annotation 3.1.1 | | |-- meta... | | |-- path... | | |-- pubspec_parse... | | '-- yaml... | |-- build_daemon 2.1.4 | | |-- built_collection 4.3.2 | | | |-- collection... | | | '-- quiver... | | |-- built_value 7.1.0 | | | |-- built_collection... | | | |-- collection... | | | |-- fixnum 0.10.11 | | | '-- quiver... | | |-- http_multi_server... | | |-- logging... | | |-- path... | | |-- pedantic... | | |-- pool... | | |-- shelf... | | |-- shelf_web_socket... | | |-- stream_transform... | | |-- watcher... | | '-- web_socket_channel... | |-- build_resolvers 1.4.3 | | |-- analyzer... | | |-- build... | | |-- crypto... | | |-- graphs... | | |-- logging... | | |-- meta... | | |-- package_config... | | |-- path... | | |-- pool... | | '-- pub_semver... | |-- build_runner_core 6.1.1 | | |-- async... | | |-- build... | | |-- build_config... | | |-- build_resolvers... | | |-- collection... | | |-- convert... | | |-- crypto... | | |-- glob... | | |-- graphs... | | |-- json_annotation... | | |-- logging... | | |-- meta... | | |-- package_config... | | |-- path... | | |-- pedantic... | | |-- pool... | | |-- timing... | | |-- watcher... | | '-- yaml... | |-- code_builder 3.5.0 | | |-- built_collection... | | |-- built_value... | | |-- collection... | | |-- matcher... | | '-- meta... | |-- collection... | |-- crypto... | |-- dart_style 1.3.10 | | |-- analyzer... | | |-- args... | | |-- path... | | '-- source_span... | |-- glob 1.2.0 | | |-- async... | | |-- collection... | | |-- node_io 1.2.0 | | | |-- file 5.2.1 | | | | |-- intl... | | | | |-- meta... | | | | '-- path... | | | |-- node_interop 1.2.1 | | | | '-- js... | | | '-- path... | | |-- path... | | |-- pedantic... | | '-- string_scanner... | |-- graphs 0.2.0 | |-- http_multi_server 2.2.0 | | '-- async... | |-- io 0.3.4 | | |-- charcode... | | |-- meta... | | |-- path... | | '-- string_scanner... | |-- js 0.6.3-nullsafety.3 | |-- logging 0.11.4 | |-- meta... | |-- mime 0.9.7 | |-- path... | |-- pedantic... | |-- pool 1.4.0 | | |-- async... | | '-- stack_trace... | |-- pub_semver 1.4.4 | | '-- collection... | |-- pubspec_parse 0.1.5 | | |-- checked_yaml... | | |-- json_annotation... | | |-- pub_semver... | | '-- yaml... | |-- shelf 0.7.9 | | |-- async... | | |-- collection... | | |-- http_parser... | | |-- path... | | |-- stack_trace... | | '-- stream_channel... | |-- shelf_web_socket 0.2.3 | | |-- shelf... | | |-- stream_channel... | | '-- web_socket_channel... | |-- stack_trace 1.10.0-nullsafety.6 | | '-- path... | |-- stream_transform 1.2.0 | |-- timing 0.1.1+2 | | '-- json_annotation... | |-- watcher 0.9.7+15 | | |-- async... | | |-- path... | | '-- pedantic... | |-- web_socket_channel 1.1.0 | | |-- async... | | |-- crypto... | | '-- stream_channel... | '-- yaml 2.2.1 | |-- charcode... | |-- collection... | |-- source_span... | '-- string_scanner... |-- cloud_firestore 0.14.3+1 | |-- cloud_firestore_platform_interface 2.2.0 | | |-- collection... | | |-- firebase_core... | | |-- flutter... | | |-- meta... | | '-- plugin_platform_interface... | |-- cloud_firestore_web 0.2.1+1 | | |-- cloud_firestore_platform_interface... | | |-- firebase_core... | | |-- firebase_core_web... | | |-- flutter... | | |-- flutter_web_plugins 0.0.0 | | | |-- characters... | | | |-- collection... | | | |-- flutter... | | | |-- js... | | | |-- meta... | | | |-- typed_data... | | | '-- vector_math... | | |-- http_parser 3.1.4 | | | |-- charcode... | | | |-- collection... | | | |-- source_span... | | | |-- string_scanner... | | | '-- typed_data... | | |-- js... | | '-- meta... | |-- firebase_core 0.5.2+1 | | |-- firebase_core_platform_interface... | | |-- firebase_core_web 0.2.1+1 | | | |-- firebase_core_platform_interface... | | | |-- flutter... | | | |-- flutter_web_plugins... | | | |-- js... | | | '-- meta... | | |-- flutter... | | |-- meta... | | '-- quiver... | |-- firebase_core_platform_interface 2.1.0 | | |-- flutter... | | |-- meta... | | |-- plugin_platform_interface... | | '-- quiver... | |-- flutter... | |-- meta... | '-- quiver 2.1.5 | |-- matcher... | '-- meta... |-- cupertino_icons 0.1.3 |-- direct_select_flutter 1.0.6 | |-- cupertino_icons... | |-- flutter... | '-- rect_getter 0.1.0 | '-- flutter... |-- flutter 0.0.0 | |-- characters 1.1.0-nullsafety.5 | |-- collection 1.15.0-nullsafety.5 | |-- meta 1.3.0-nullsafety.6 | |-- sky_engine 0.0.99 | |-- typed_data 1.3.0-nullsafety.5 | | '-- collection... | '-- vector_math 2.1.0-nullsafety.5 |-- flutter_riverpod 0.12.1 | |-- collection... | |-- flutter... | |-- meta... | |-- riverpod 0.12.1 | | |-- collection... | | |-- freezed_annotation 0.12.0 | | | |-- collection... | | | |-- json_annotation... | | | '-- meta... | | |-- meta... | | '-- state_notifier... | '-- state_notifier 0.6.0 | '-- meta... |-- flutter_slidable 0.5.7 | '-- flutter... |-- flutter_test 0.0.0 | |-- async... | |-- boolean_selector 2.1.0-nullsafety.3 | | |-- source_span... | | '-- string_scanner... | |-- characters... | |-- charcode 1.2.0-nullsafety.3 | |-- clock 1.1.0-nullsafety.3 | |-- collection... | |-- fake_async 1.2.0-nullsafety.3 | | |-- clock... | | '-- collection... | |-- flutter... | |-- matcher 0.12.10-nullsafety.3 | | '-- stack_trace... | |-- meta... | |-- path... | |-- source_span 1.8.0-nullsafety.4 | | |-- charcode... | | |-- collection... | | |-- path... | | '-- term_glyph... | |-- stack_trace... | |-- stream_channel 2.1.0-nullsafety.3 | | '-- async... | |-- string_scanner 1.1.0-nullsafety.3 | | |-- charcode... | | '-- source_span... | |-- term_glyph 1.2.0-nullsafety.3 | |-- test_api 0.2.19-nullsafety.6 | | |-- async... | | |-- boolean_selector... | | |-- collection... | | |-- matcher... | | |-- meta... | | |-- path... | | |-- source_span... | | |-- stack_trace... | | |-- stream_channel... | | |-- string_scanner... | | '-- term_glyph... | |-- typed_data... | '-- vector_math... |-- geolocator 6.1.7 | |-- flutter... | '-- geolocator_platform_interface 1.0.8 | |-- flutter... | |-- meta... | |-- plugin_platform_interface... | '-- vector_math... |-- get 3.17.1 | '-- flutter... |-- google_fonts 1.1.1 | |-- crypto... | |-- flutter... | |-- http 0.12.2 | | |-- http_parser... | | |-- path... | | '-- pedantic... | |-- path_provider... | '-- pedantic 1.9.2 | '-- meta... |-- google_maps_flutter 1.0.6 | |-- flutter... | |-- flutter_plugin_android_lifecycle 1.0.11 | | '-- flutter... | '-- google_maps_flutter_platform_interface 1.0.5 | |-- flutter... | |-- meta... | |-- plugin_platform_interface... | '-- stream_transform... |-- hive 1.4.4+1 | |-- crypto 2.1.5 | | |-- collection... | | |-- convert 2.1.1 | | | |-- charcode... | | | '-- typed_data... | | '-- typed_data... | '-- meta... |-- hive_generator 0.8.2 | |-- analyzer 0.40.6 | | |-- _fe_analyzer_shared 12.0.0 | | | '-- meta... | | |-- args... | | |-- cli_util 0.2.0 | | | '-- path... | | |-- collection... | | |-- convert... | | |-- crypto... | | |-- glob... | | |-- meta... | | |-- package_config 1.9.3 | | | |-- charcode... | | | '-- path... | | |-- path... | | |-- pub_semver... | | |-- source_span... | | |-- watcher... | | '-- yaml... | |-- build 1.5.1 | | |-- analyzer... | | |-- async... | | |-- convert... | | |-- crypto... | | |-- glob... | | |-- logging... | | |-- meta... | | '-- path... | |-- dartx 0.5.0 | | |-- characters... | | |-- collection... | | |-- crypto... | | |-- meta... | | |-- path... | | '-- time 1.4.0 | |-- hive... | '-- source_gen 0.9.8 | |-- analyzer... | |-- async... | |-- build... | |-- dart_style... | |-- glob... | |-- meta... | |-- path... | |-- pedantic... | '-- source_span... |-- implicitly_animated_reorderable_list 0.3.2 | |-- async 2.5.0-nullsafety.3 | | '-- collection... | |-- flutter... | '-- meta... |-- intl 0.16.1 | '-- path 1.8.0-nullsafety.3 |-- path_provider 1.6.24 | |-- flutter... | |-- path_provider_linux 0.0.1+2 | | |-- flutter... | | |-- path... | | |-- path_provider_platform_interface... | | '-- xdg_directories 0.1.2 | | |-- meta... | | |-- path... | | '-- process 3.0.13 | | |-- file... | | |-- intl... | | |-- meta... | | |-- path... | | '-- platform... | |-- path_provider_macos 0.0.4+6 | | '-- flutter... | |-- path_provider_platform_interface 1.0.4 | | |-- flutter... | | |-- meta... | | |-- platform 2.2.1 | | '-- plugin_platform_interface 1.0.3 | | '-- meta... | '-- path_provider_windows 0.0.4+3 | |-- ffi 0.1.3 | |-- flutter... | |-- meta... | |-- path... | |-- path_provider_platform_interface... | '-- win32 1.7.4 | '-- ffi... |-- permission_handler 5.0.1+1 | |-- flutter... | |-- meta... | '-- permission_handler_platform_interface 2.0.1 | |-- flutter... | |-- meta... | '-- plugin_platform_interface... |-- rename 1.2.0 | |-- args 1.6.0 | '-- logger 0.9.4 |-- rxdart 0.24.1 '-- wakelock 0.1.4+2 '-- flutter... ```

markusaksli-nc commented 3 years ago

Hi @sgalway00 Could you provide a minimal complete reproducible code sample? You could change the official example code for example. Thank you

TahaTesser commented 3 years ago

It's firing both messages in the console when the latest cloud_firestore: ^0.14.3+1

code sample ```dart import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:firebase_core/firebase_core.dart'; import 'package:flutter/material.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); FirebaseApp app = await Firebase.initializeApp(); assert(app != null); runApp(MyApp()); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, title: 'Material App', theme: ThemeData.dark(), home: Home(), ); } } class Home extends StatefulWidget { @override _HomeState createState() => _HomeState(); } class _HomeState extends State { final _db = FirebaseFirestore.instance; @override void initState() { super.initState(); Stream _docStream = FirebaseFirestore.instance .collection('Athlete1') .doc('currentPosition') .snapshots(); if (_docStream.isBroadcast == true) { print('Stream is broadcasting'); } _docStream.listen((event) { print('athletePos stream event received'); print(event.data().toString()); }); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text('Material App Bar'), ), body: Center( child: Container( child: Text('Hello World'), ), ), floatingActionButton: FloatingActionButton( child: Icon(Icons.add), onPressed: () {}, ), ); } } ```

iOS

Launching lib/main.dart on iPhone 12 in debug mode...
lib/main.dart:1
Warning: Podfile is out of date
  This can cause issues if your application depends on plugins that do not support iOS.
  See https://flutter.dev/docs/development/packages-and-plugins/developing-packages#plugin-platforms for details.
  If you have local Podfile edits you would like to keep, see https://github.com/flutter/flutter/issues/45197 for instructions.
To regenerate the Podfile, run:
  rm ios/Podfile

Xcode build done.                                           228.4s
Connecting to VM Service at ws://127.0.0.1:61612/ivaXgY8pNEo=/ws
flutter: Stream is broadcasting
flutter: athletePos stream event received
flutter: {content: dummy_content, title: dummy_title}

Android

I/flutter ( 6858): Stream is broadcasting
W/DynamiteModule( 6858): Local module descriptor class for providerinstaller not found.
I/DynamiteModule( 6858): Considering local module providerinstaller:0 and remote module providerinstaller:0
W/ProviderInstaller( 6858): Failed to load providerinstaller module: No acceptable module found. Local version is 0 and remote version is 0.
I/flutter ( 6858): athletePos stream event received
I/flutter ( 6858): {title: dummy_title, content: dummy_content}
flutter doctor -v ```bash [βœ“] Flutter (Channel stable, 1.22.4, on macOS 11.0.1 20B29 darwin-x64, locale en-GB) β€’ Flutter version 1.22.4 at /Users/tahatesser/Code/flutter_stable β€’ Framework revision 1aafb3a8b9 (2 weeks ago), 2020-11-13 09:59:28 -0800 β€’ Engine revision 2c956a31c0 β€’ Dart version 2.10.4 [βœ“] Android toolchain - develop for Android devices (Android SDK version 30.0.2) β€’ Android SDK at /Users/tahatesser/Code/sdk β€’ Platform android-30, build-tools 30.0.2 β€’ ANDROID_HOME = /Users/tahatesser/Code/sdk β€’ Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java β€’ Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495) β€’ All Android licenses accepted. [βœ“] Xcode - develop for iOS and macOS (Xcode 12.2) β€’ Xcode at /Volumes/Extreme/Xcode.app/Contents/Developer β€’ Xcode 12.2, Build version 12B45b β€’ CocoaPods version 1.10.0 [!] Android Studio (version 4.1) β€’ Android Studio at /Applications/Android Studio.app/Contents βœ— Flutter plugin not installed; this adds Flutter specific functionality. βœ— Dart plugin not installed; this adds Dart specific functionality. β€’ Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495) [βœ“] VS Code (version 1.51.1) β€’ VS Code at /Applications/Visual Studio Code.app/Contents β€’ Flutter extension version 3.16.0 [βœ“] Connected device (3 available) β€’ RMX2001 (mobile) β€’ EUYTFEUSQSRGDA6D β€’ android-arm64 β€’ Android 10 (API 29) β€’ Android SDK built for x86 (mobile) β€’ emulator-5554 β€’ android-x86 β€’ Android 8.0.0 (API 26) (emulator) β€’ iPhone 12 (mobile) β€’ BBCEDCF6-A80B-49DC-86EE-C9B542A9AD1B β€’ ios β€’ com.apple.CoreSimulator.SimRuntime.iOS-14-2 (simulator) ! Doctor found issues in 1 category. ```
sgalway00 commented 3 years ago

Code below shows using a simple .get() and a .listen(). The terminal shows that the get() works, but the listen() does not.

import 'package:flutter/material.dart';

class MapPageView extends StatefulWidget {
  const MapPageView({Key key}) : super(key: key);

  @override
  _MapPageViewState createState() => _MapPageViewState();
}

class _MapPageViewState extends State<MapPageView> {
  @override
  void initState() {
    super.initState();

    readCurPos();

    Stream<DocumentSnapshot> _docStream = FirebaseFirestore.instance.
      collection('Athlete1').
      doc('currentPosition').snapshots();

    if (_docStream.isBroadcast == true) {
      print('Stream is broadcasting');
    }

    _docStream.listen((event) {
      print('athletePos stream event received');
      print(event.data().toString());
    });
  }

  Future<void> readCurPos() async {
    DocumentSnapshot _docSnap = await FirebaseFirestore.instance.
      collection('Athlete1').
      doc('currentPosition').get();

    var dataSnap = _docSnap.data();

    double lat = dataSnap["lat"];
    double long = dataSnap["long"];

    print('Lat: $lat, Long: $long');
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Material App Bar'),
      ),
      body: Center(
        child: Container(
          child: Text('Hello World'),
        ),
      ),
      floatingActionButton: FloatingActionButton(
        child: Icon(Icons.add),
        onPressed: () {},
      ),
    );
  }
}

terminal output iOS:

lib/main.dart:1
Xcode build done.                                           41.8s
Connecting to VM Service at ws://127.0.0.1:56796/5mn4fA8mzlU=/ws
flutter: InitFirebase started
[GETX] "GetMaterialController" has been initialized
flutter: Firebase init
flutter: ConfigDash windowStream is loading
flutter: InitWindows has run
flutter: Stream is broadcasting
flutter: Lat: 29.709576813683668, Long: -95.94260267789087

terminal output Android:

I/flutter (14360): Stream is broadcasting
I/flutter (14360): athletePos stream event received
I/flutter (14360): {waypoint: none, vmg: 0.0, smoothHeading: 173, smoothSpeed: 0.2, accuracy: 19.84856861039839, lat: 29.709576813683668, long: -95.94260267789087, timestamp: Timestamp(seconds=1606699, nanoseconds=476999000)}
I/flutter (14360): Lat: 29.709576813683668, Long: -95.94260267789087
markusaksli-nc commented 3 years ago

Seems to be working fine for me as well on the latest master 1.24.0-8.0.pre.375 using cloud_firestore: ^0.14.3+1.

flutter doctor -v ``` [√] Flutter (Channel master, 1.24.0-8.0.pre.375, on Microsoft Windows [Version 10.0.19041.630], locale et-EE) β€’ Flutter version 1.24.0-8.0.pre.375 at C:\Development\flutter_master β€’ Framework revision a7f5fd5360 (22 hours ago), 2020-11-30 13:14:13 +0100 β€’ Engine revision 20caf54969 β€’ Dart version 2.12.0 (build 2.12.0-76.0.dev) [√] Android toolchain - develop for Android devices (Android SDK version 30.0.2) β€’ Android SDK at C:\Users\marku\AppData\Local\Android\sdk β€’ Platform android-30, build-tools 30.0.2 β€’ Java binary at: C:\Users\marku\AppData\Local\JetBrains\Toolbox\apps\AndroidStudio\ch-0\201.6953283\jre\bin\java β€’ Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01) β€’ All Android licenses accepted. [√] Chrome - develop for the web β€’ Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe [√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.7.7) β€’ Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community β€’ Visual Studio Community 2019 version 16.7.30621.155 β€’ Windows 10 SDK version 10.0.18362.0 [√] Android Studio (version 4.1.0) β€’ Android Studio at C:\Users\marku\AppData\Local\JetBrains\Toolbox\apps\AndroidStudio\ch-0\201.6953283 β€’ Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter β€’ Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart β€’ Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01) [√] IntelliJ IDEA Ultimate Edition (version 2020.2) β€’ IntelliJ at C:\Users\marku\AppData\Local\JetBrains\Toolbox\apps\IDEA-U\ch-0\202.8194.7 β€’ Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter β€’ Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart [√] Connected device (6 available) β€’ SM G950F (mobile) β€’ ce12171c51cc001c03 β€’ android-arm64 β€’ Android 9 (API 28) β€’ sdk gphone x86 arm (mobile) β€’ emulator-5554 β€’ android-x86 β€’ Android 11 (API 30) (emulator) β€’ Windows (desktop) β€’ windows β€’ windows-x64 β€’ Microsoft Windows [Version 10.0.19041.630] β€’ Web Server (web) β€’ web-server β€’ web-javascript β€’ Flutter Tools β€’ Chrome (web) β€’ chrome β€’ web-javascript β€’ Google Chrome 87.0.4280.66 β€’ Edge (web) β€’ edge β€’ web-javascript β€’ Microsoft Edge 87.0.664.47 β€’ No issues found! ```

Android

I/flutter (10615): athletePos stream event received
I/flutter (10615): {long: 1.01, lat: 1.01}
I/flutter (10615): Lat: 1.01, Long: 1.01

iOS

flutter: athletePos stream event received
flutter: {lat: 1.01, long: 1.01}
flutter: Lat: 1.01, Long: 1.01
pschuegr commented 3 years ago

I believe I'm seeing this problem with 0.14.4. It is reproducible for me in ios emulator and on device, while android build and macos build produce stream snapshots normally. However I downgraded to 0.14.3+1 and seemed to have the same problem so I don't know if it's the same. In my case, it may be related to caching - my isFromCache seems to be always true, so my suspicion is that it is not properly receiving upstream information from the server.

Dart SDK 2.12.0-141.0.dev
Flutter SDK 1.26.0-1.0.pre
calliope 1.0.0+1

dependencies:
- args 1.6.0
- audio_service 0.15.3 [audio_session rxdart flutter_isolate flutter_cache_manager js flutter flutter_web_plugins]
- audio_session 0.0.9 [flutter flutter_web_plugins rxdart]
- cloud_firestore 0.14.3+1 [flutter meta quiver firebase_core firebase_core_platform_interface cloud_firestore_platform_interface cloud_firestore_web]
- cupertino_icons 1.0.1+1
- firebase_auth 0.18.4+1 [meta firebase_core firebase_core_platform_interface firebase_auth_platform_interface firebase_auth_web flutter]
- firebase_core 0.5.3 [firebase_core_platform_interface flutter quiver meta firebase_core_web]
- firebase_storage 5.2.0 [flutter firebase_core firebase_core_platform_interface firebase_storage_web firebase_storage_platform_interface quiver]
- flutter 0.0.0 [characters collection meta typed_data vector_math sky_engine]
- google_sign_in 4.5.6 [google_sign_in_platform_interface flutter meta google_sign_in_web]
- just_audio 0.6.3 [just_audio_platform_interface just_audio_web audio_session rxdart path path_provider async uuid flutter]
- path 1.8.0-nullsafety.3
- provider 4.3.2+3 [collection flutter nested]
- shared_preferences 0.5.12+4 [meta flutter shared_preferences_platform_interface shared_preferences_linux shared_preferences_macos shared_preferences_web shared_preferences_windows]
- util 0.0.0 [chunked_stream dart_numerics]
- uuid 2.2.2 [crypto convert]
- watcher 0.9.7+15 [async path pedantic]

dev dependencies:
- flutter_test 0.0.0 [flutter test_api path fake_async clock stack_trace vector_math async boolean_selector characters charcode collection matcher meta source_span stream_channel string_scanner term_glyph typed_data]

transitive dependencies:
- async 2.5.0-nullsafety.3 [collection]
- boolean_selector 2.1.0-nullsafety.3 [source_span string_scanner]
- characters 1.1.0-nullsafety.5
- charcode 1.2.0-nullsafety.3
- chunked_stream 1.1.0
- clock 1.1.0-nullsafety.3
- cloud_firestore_platform_interface 2.2.1 [flutter meta collection firebase_core plugin_platform_interface]
- cloud_firestore_web 0.2.1+2 [flutter flutter_web_plugins http_parser meta firebase_core firebase_core_web cloud_firestore_platform_interface js]
- collection 1.15.0-nullsafety.5
- convert 2.1.1 [charcode typed_data]
- crypto 2.1.5 [collection convert typed_data]
- dart_numerics 0.0.5 [tuple]
- fake_async 1.2.0-nullsafety.3 [clock collection]
- ffi 0.1.3
- file 5.2.1 [intl meta path]
- firebase_auth_platform_interface 2.1.4 [flutter meta firebase_core plugin_platform_interface]
- firebase_auth_web 0.3.2+3 [flutter flutter_web_plugins meta http_parser intl firebase_core firebase_core_web firebase_auth_platform_interface js]
- firebase_core_platform_interface 2.1.0 [flutter meta plugin_platform_interface quiver]
- firebase_core_web 0.2.1+1 [firebase_core_platform_interface flutter flutter_web_plugins meta js]
- firebase_storage_platform_interface 1.0.2 [flutter meta collection firebase_core plugin_platform_interface]
- firebase_storage_web 0.1.1+1 [async crypto firebase_core firebase_core_web firebase_storage_platform_interface flutter flutter_web_plugins http js meta]
- flutter_cache_manager 1.4.2 [flutter path_provider uuid http path sqflite pedantic clock file rxdart]
- flutter_isolate 1.0.0+14 [flutter uuid]
- flutter_web_plugins 0.0.0 [flutter js characters collection meta typed_data vector_math]
- google_sign_in_platform_interface 1.1.2 [flutter meta quiver]
- google_sign_in_web 0.9.2 [google_sign_in_platform_interface flutter flutter_web_plugins meta js]
- http 0.12.2 [http_parser path pedantic]
- http_parser 3.1.4 [charcode collection source_span string_scanner typed_data]
- intl 0.16.1 [path]
- js 0.6.3-nullsafety.3
- just_audio_platform_interface 2.0.0 [flutter meta plugin_platform_interface]
- just_audio_web 0.2.1 [just_audio_platform_interface flutter flutter_web_plugins meta]
- matcher 0.12.10-nullsafety.3 [stack_trace]
- meta 1.3.0-nullsafety.6
- nested 0.0.4 [flutter]
- path_provider 1.6.24 [flutter path_provider_platform_interface path_provider_macos path_provider_linux path_provider_windows]
- path_provider_linux 0.0.1+2 [path xdg_directories path_provider_platform_interface flutter]
- path_provider_macos 0.0.4+6 [flutter]
- path_provider_platform_interface 1.0.4 [flutter meta platform plugin_platform_interface]
- path_provider_windows 0.0.4+3 [path_provider_platform_interface meta path flutter ffi win32]
- pedantic 1.9.2 [meta]
- platform 2.2.1
- plugin_platform_interface 1.0.3 [meta]
- process 3.0.13 [file intl meta path platform]
- quiver 2.1.5 [matcher meta]
- rxdart 0.24.1
- shared_preferences_linux 0.0.2+4 [file flutter meta path path_provider_linux shared_preferences_platform_interface]
- shared_preferences_macos 0.0.1+11 [shared_preferences_platform_interface flutter]
- shared_preferences_platform_interface 1.0.4 [meta flutter]
- shared_preferences_web 0.1.2+7 [shared_preferences_platform_interface flutter flutter_web_plugins meta]
- shared_preferences_windows 0.0.1+3 [shared_preferences_platform_interface flutter ffi file meta path path_provider_platform_interface path_provider_windows]
- sky_engine 0.0.99
- source_span 1.8.0-nullsafety.4 [charcode collection path term_glyph]
- sqflite 1.3.2+1 [flutter sqflite_common path]
- sqflite_common 1.0.2+1 [synchronized path meta]
- stack_trace 1.10.0-nullsafety.6 [path]
- stream_channel 2.1.0-nullsafety.3 [async]
- string_scanner 1.1.0-nullsafety.3 [charcode source_span]
- synchronized 2.2.0+2
- term_glyph 1.2.0-nullsafety.3
- test_api 0.2.19-nullsafety.6 [async boolean_selector collection meta path source_span stack_trace stream_channel string_scanner term_glyph matcher]
- tuple 1.0.3 [quiver]
- typed_data 1.3.0-nullsafety.5 [collection]
- vector_math 2.1.0-nullsafety.5
- win32 1.7.4 [ffi]
- xdg_directories 0.1.2 [meta path process]
pschuegr commented 3 years ago

It looks like my problem is caused by https://github.com/FirebaseExtended/flutterfire/issues/3671. The fix by sc4v3ng3r here https://github.com/FirebaseExtended/flutterfire/issues/3671#issuecomment-746990151 seems to resolve it.

markusaksli-nc commented 3 years ago

@sgalway00 Can you confirm what @pschuegr commented?

If the root cause is #3671 I would prefer closing this issue and just tracking it there.

pschuegr commented 3 years ago

I have a up-to-date fork of the flutterfire repo with sc4v3ng3r's fix applied at https://github.com/pschuegr/flutterfire, if you want to check quickly.

ened commented 3 years ago

@pschuegr perhaps you can check the comment on https://github.com/FirebaseExtended/flutterfire/issues/3671#issuecomment-751704186 including the link to the PR which hopefully resolves a variety of Isolate issues. Thank you.

pschuegr commented 3 years ago

@ened, @markusaksli-nc the PR for #3671 resolves this for me.