Closed sgalway00 closed 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
It's firing both messages in the console when the latest cloud_firestore: ^0.14.3+1
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}
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}
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
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
.
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
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]
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.
@sgalway00 Can you confirm what @pschuegr commented?
If the root cause is #3671 I would prefer closing this issue and just tracking it there.
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.
@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.
@ened, @markusaksli-nc the PR for #3671 resolves this for me.
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
Expected behavior
Expect both print statements to fire. On iOS only "Stream is broadcasting" will fire. On Android, both will fire.
Flutter doctor
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... ```