Skip to content

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

Closed
@sgalway00

Description

@sgalway00

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...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions