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.7k stars 3.97k forks source link

🐛 [firebase_messaging] Hot Restarting freezes the application #11791

Closed M-Yahia2011 closed 11 months ago

M-Yahia2011 commented 1 year ago

When i hot restart the app while debugging it freezes;

This how i use the package: main.dart:

final navigatorKey = GlobalKey<NavigatorState>();

void main() async {
  WidgetsBinding widgetsBinding = WidgetsFlutterBinding.ensureInitialized();

  SystemChrome.setPreferredOrientations(
      [DeviceOrientation.portraitUp, DeviceOrientation.portraitDown]);
  await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);

  await MobileAds.instance.initialize();
  await NotificationService.instance.initNotifications();

  FlutterNativeSplash.preserve(widgetsBinding: widgetsBinding);
  BalootGameValues();
  HandGameValues();
  FlutterNativeSplash.remove();
  await dotenv.load(fileName: "assets/.env");

  runApp(
    const MainApp(),
  );
  // Bloc.observer = AppBlocObserver();
}

NotificationService:

import 'dart:convert';
import 'dart:io';

import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:shared_preferences/shared_preferences.dart';

import '../../presentation/screens/notifications_screen.dart';
import '../models/user_model.dart';

import '/main.dart';
import 'user_crud_service.dart';

final localNotificationPlugin = FlutterLocalNotificationsPlugin();

class NotificationService {
  NotificationService._();
  static final NotificationService instance =
      NotificationService._();
  final _androidChanel = const AndroidNotificationChannel("qydha", "qydha");

  Future<void> initNotifications() async {
    await FirebaseMessaging.instance.requestPermission();
    initPushNotification();
    initLocalNotification();
  }

  Future<void> saveFCMToken() async {
    final SharedPreferences prefs = await SharedPreferences.getInstance();
    User user = User.fromJson(jsonDecode(prefs.getString("user")!));
    String? fcmToken = await FirebaseMessaging.instance.getToken();
    await UserCRUDService.instance.saveFcmToken(fcmToken, user.id!);
  }

  Future<void> initPushNotification() async {
    await FirebaseMessaging.instance
        .setForegroundNotificationPresentationOptions(
            alert: true, badge: true, sound: true);

    /// Do an action if the app is opened from a notification when it is terminated
    FirebaseMessaging.instance.getInitialMessage().then(handleMessage);

    /// Do an action if the app is opened from a notification when it is in the background
    FirebaseMessaging.onMessageOpenedApp.listen(handleMessage);
    FirebaseMessaging.onBackgroundMessage(handleBackGroundNotifications);

    /// Do an action if the app is on the foreground
    FirebaseMessaging.onMessage.listen((message) {
      final RemoteNotification? notification = message.notification;
      if (notification == null) {
        return;
      }
      localNotificationPlugin.show(
          notification.hashCode,
          notification.title,
          notification.body,
          NotificationDetails(
            android: AndroidNotificationDetails(
                _androidChanel.id, _androidChanel.name),
            iOS: const DarwinNotificationDetails(),
          ),
          payload: jsonEncode(message.toMap()));
    });
  }

  Future<void> initLocalNotification() async {
    const DarwinInitializationSettings ios = DarwinInitializationSettings();
    const AndroidInitializationSettings android =
        AndroidInitializationSettings("@mipmap/launcher_icon");
    const settings = InitializationSettings(android: android, iOS: ios);
    await localNotificationPlugin.initialize(
      settings,
      onDidReceiveNotificationResponse: (details) {
        final message = RemoteMessage.fromMap(jsonDecode(details.payload!));
        handleMessage(message);
      },
    );
    if (Platform.isAndroid) {
      await localNotificationPlugin
          .resolvePlatformSpecificImplementation<
              AndroidFlutterLocalNotificationsPlugin>()!
          .createNotificationChannel(_androidChanel);
    }
    if (Platform.isIOS) {
      await localNotificationPlugin
          .resolvePlatformSpecificImplementation<
              IOSFlutterLocalNotificationsPlugin>()!
          .requestPermissions(
            alert: true,
            badge: true,
            sound: true,
          );
    }
  }

  void handleMessage(RemoteMessage? message) {
    if (message == null) {
      return;
    } else {
      // TODO: UserCRUD.instance.saveNotification();
      navigatorKey.currentState
          ?.pushNamed(NotificationsScreen.routeName, arguments: message);
    }
  }
}

@pragma('vm:entry-point')
Future<void> handleBackGroundNotifications(RemoteMessage? message) async {
  await Firebase.initializeApp();
  if (message == null) {
    return;
  } else {
    navigatorKey.currentState
        ?.pushNamed(NotificationsScreen.routeName, arguments: message);
  }
}

Flutter doctor

Run flutter doctor and paste the output below:

Click To Expand ``` flutter doctor -v [√] Flutter (Channel stable, 3.13.8, on Microsoft Windows [Version 10.0.19045.3570], locale en-US) • Flutter version 3.13.8 on channel stable at C:\flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 6c4930c4ac (10 days ago), 2023-10-18 10:57:55 -0500 • Engine revision 767d8c75e8 • Dart version 3.1.4 • DevTools version 2.25.0 [√] Windows Version (Installed version of Windows is version 10 or higher) [√] Android toolchain - develop for Android devices (Android SDK version 33.0.2) • Android SDK at C:\Users\Mohamed.Yahia\AppData\Local\Android\Sdk • Platform android-33-ext4, build-tools 33.0.2 • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java • Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-10027231) • All Android licenses accepted. [√] Chrome - develop for the web • Chrome at C:\Users\Mohamed.Yahia\AppData\Local\Google\Chrome\Application\chrome.exe [√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.7.0) • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community • Visual Studio Community 2022 version 17.7.34003.232 • Windows 10 SDK version 10.0.22621.0 [√] Android Studio (version 2022.3) • Android Studio at C:\Program Files\Android\Android Studio • 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 17.0.6+0-b2043.56-10027231) [√] VS Code (version 1.83.1) • VS Code at C:\Users\Mohamed.Yahia\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.74.0 [√] Connected device (4 available) • SM S906E (mobile) • RFCTA06PPAF • android-arm64 • Android 13 (API 33) • Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19045.3570] • Chrome (web) • chrome • web-javascript • Google Chrome 118.0.5993.118 • Edge (web) • edge • web-javascript • Microsoft Edge 118.0.2088.46 [√] Network resources • All expected network resources are available. ```

Flutter dependencies

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

Click To Expand ``` Dart SDK 3.1.4 Flutter SDK 3.13.8 qydha 2.3.55+1 dependencies: - anim_search_bar 2.0.3 [flutter] - animated_splash_screen 1.3.0 [flutter page_transition] - cached_network_image 3.3.0 [cached_network_image_platform_interface cached_network_image_web flutter flutter_cache_manager octo_image] - change_app_package_name 1.1.0 - checkbox_grouped 2.0.0 [flutter auto_size_text collection] - cloud_firestore 4.11.0 [cloud_firestore_platform_interface cloud_firestore_web collection firebase_core firebase_core_platform_interface flutter meta] - device_preview 1.1.0 [flutter flutter_localizations provider device_frame freezed_annotation json_annotation shared_preferences collection] - dio 5.3.3 [async http_parser meta path] - emoji_picker_flutter 1.6.2 [flutter flutter_web_plugins plugin_platform_interface shared_preferences] - expandable_bottom_sheet 1.1.1+1 [flutter] - firebase_core 2.19.0 [firebase_core_platform_interface firebase_core_web flutter meta] - firebase_messaging 14.7.1 [firebase_core firebase_core_platform_interface firebase_messaging_platform_interface firebase_messaging_web flutter meta] - flutter 0.0.0 [characters collection material_color_utilities meta vector_math web sky_engine] - flutter_bloc 8.1.3 [bloc flutter provider] - flutter_cache_manager 3.3.1 [clock collection file flutter http path path_provider rxdart sqflite uuid] - flutter_dotenv 5.1.0 [flutter] - flutter_local_notifications 16.1.0 [clock flutter flutter_local_notifications_linux flutter_local_notifications_platform_interface timezone] - flutter_native_splash 2.3.4 [args flutter flutter_web_plugins js html image meta path universal_io xml yaml] - flutter_spinkit 5.2.0 [flutter] - flutter_windowmanager 0.2.0 [flutter] - google_fonts 6.1.0 [flutter http path_provider crypto] - google_mobile_ads 3.1.0 [meta flutter visibility_detector webview_flutter_android webview_flutter_wkwebview webview_flutter] - gradient_borders 1.0.0 [flutter] - group_button 5.3.3 [flutter] - iaphub_flutter 1.0.3 [flutter] - image_picker 1.0.4 [flutter image_picker_android image_picker_for_web image_picker_ios image_picker_linux image_picker_macos image_picker_platform_interface image_picker_windows] - intl 0.18.1 [clock meta path] - jwt_decode 0.3.1 - material_symbols_icons 4.2671.0 [flutter] - modal_progress_hud_nsn 0.4.0 [flutter flutter_web_plugins plugin_platform_interface] - once 1.5.4 [flutter shared_preferences package_info_plus] - page_transition 2.1.0 [flutter] - path 1.8.3 - pinput 3.0.1 [flutter smart_auth universal_platform] - shared_preferences 2.2.2 [flutter shared_preferences_android shared_preferences_foundation shared_preferences_linux shared_preferences_platform_interface shared_preferences_web shared_preferences_windows] - star_menu 3.1.4 [flutter vector_math] - syncfusion_flutter_pdfviewer 23.1.41 [flutter vector_math async http uuid device_info_plus intl syncfusion_pdfviewer_platform_interface syncfusion_pdfviewer_web syncfusion_pdfviewer_macos syncfusion_pdfviewer_windows syncfusion_flutter_core syncfusion_flutter_pdf syncfusion_flutter_signaturepad url_launcher] - toggle_switch 2.1.0 [flutter] - vibration 1.8.3 [flutter device_info_plus] dev dependencies: - build_runner 2.4.6 [analyzer args async build build_config build_daemon build_resolvers build_runner_core code_builder collection crypto dart_style frontend_server_client glob graphs http_multi_server io js logging meta mime package_config path pool pub_semver pubspec_parse shelf shelf_web_socket stack_trace stream_transform timing watcher web_socket_channel yaml] - flutter_launcher_icons 0.13.1 [args checked_yaml cli_util image json_annotation path yaml] - flutter_lints 2.0.3 [lints] - flutter_test 0.0.0 [flutter test_api matcher path fake_async clock stack_trace vector_math async boolean_selector characters collection material_color_utilities meta source_span stream_channel string_scanner term_glyph web] transitive dependencies: - _fe_analyzer_shared 64.0.0 [meta] - _flutterfire_internals 1.3.9 [collection firebase_core firebase_core_platform_interface flutter meta] - analyzer 6.2.0 [_fe_analyzer_shared collection convert crypto glob meta package_config path pub_semver source_span watcher yaml] - archive 3.4.6 [crypto path pointycastle] - args 2.4.2 - async 2.11.0 [collection meta] - auto_size_text 3.0.0 [flutter] - bloc 8.1.2 [meta] - boolean_selector 2.1.1 [source_span string_scanner] - build 2.4.1 [analyzer async convert crypto glob logging meta package_config path] - build_config 1.1.1 [checked_yaml json_annotation path pubspec_parse yaml] - build_daemon 4.0.0 [built_collection built_value http_multi_server logging path pool shelf shelf_web_socket stream_transform watcher web_socket_channel] - build_resolvers 2.4.1 [analyzer async build collection convert crypto graphs logging package_config path pool pub_semver stream_transform yaml] - build_runner_core 7.2.11 [async build build_config build_resolvers collection convert crypto glob graphs json_annotation logging meta package_config path pool timing watcher yaml] - built_collection 5.1.1 - built_value 8.6.3 [built_collection collection fixnum meta] - cached_network_image_platform_interface 3.0.0 [flutter flutter_cache_manager] - cached_network_image_web 1.1.0 [cached_network_image_platform_interface flutter flutter_cache_manager] - characters 1.3.0 - checked_yaml 2.0.3 [json_annotation source_span yaml] - cli_util 0.4.0 [meta path] - clock 1.1.1 - cloud_firestore_platform_interface 6.0.1 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface] - cloud_firestore_web 3.8.1 [_flutterfire_internals cloud_firestore_platform_interface collection firebase_core firebase_core_web flutter flutter_web_plugins js] - code_builder 4.7.0 [built_collection built_value collection matcher meta] - collection 1.17.2 - convert 3.1.1 [typed_data] - cross_file 0.3.3+6 [js meta] - crypto 3.0.3 [typed_data] - csslib 1.0.0 [source_span] - dart_style 2.3.3 [analyzer args path pub_semver source_span] - dbus 0.7.8 [args ffi meta xml] - device_frame 1.1.0 [freezed_annotation flutter] - device_info_plus 9.1.0 [device_info_plus_platform_interface ffi file flutter flutter_web_plugins meta win32 win32_registry] - device_info_plus_platform_interface 7.0.0 [flutter meta plugin_platform_interface] - fake_async 1.3.1 [clock collection] - ffi 2.1.0 - file 7.0.0 [meta path] - file_selector_linux 0.9.2+1 [cross_file file_selector_platform_interface flutter] - file_selector_macos 0.9.3+3 [cross_file file_selector_platform_interface flutter] - file_selector_platform_interface 2.6.1 [cross_file flutter http plugin_platform_interface] - file_selector_windows 0.9.3+1 [cross_file file_selector_platform_interface flutter] - firebase_core_platform_interface 5.0.0 [collection flutter flutter_test meta plugin_platform_interface] - firebase_core_web 2.8.1 [firebase_core_platform_interface flutter flutter_web_plugins js meta] - firebase_messaging_platform_interface 4.5.10 [_flutterfire_internals firebase_core flutter meta plugin_platform_interface] - firebase_messaging_web 3.5.10 [_flutterfire_internals firebase_core firebase_core_web firebase_messaging_platform_interface flutter flutter_web_plugins js meta] - fixnum 1.1.0 - flutter_local_notifications_linux 4.0.0+1 [dbus ffi flutter flutter_local_notifications_platform_interface path xdg_directories] - flutter_local_notifications_platform_interface 7.0.0+1 [flutter plugin_platform_interface] - flutter_localizations 0.0.0 [flutter intl characters clock collection material_color_utilities meta path vector_math web] - flutter_plugin_android_lifecycle 2.0.16 [flutter] - flutter_web_plugins 0.0.0 [flutter characters collection material_color_utilities meta vector_math web] - freezed_annotation 2.4.1 [collection json_annotation meta] - frontend_server_client 3.2.0 [async path] - glob 2.1.2 [async collection file path string_scanner] - graphs 2.3.1 [collection] - html 0.15.4 [csslib source_span] - http 1.1.0 [async http_parser meta] - http_multi_server 3.2.1 [async] - http_parser 4.0.2 [collection source_span string_scanner typed_data] - image 4.1.3 [archive meta xml] - image_picker_android 0.8.8+1 [flutter flutter_plugin_android_lifecycle image_picker_platform_interface] - image_picker_for_web 3.0.1 [flutter flutter_web_plugins image_picker_platform_interface mime] - image_picker_ios 0.8.8+2 [flutter image_picker_platform_interface] - image_picker_linux 0.2.1+1 [file_selector_linux file_selector_platform_interface flutter image_picker_platform_interface] - image_picker_macos 0.2.1+1 [file_selector_macos file_selector_platform_interface flutter image_picker_platform_interface] - image_picker_platform_interface 2.9.1 [cross_file flutter http plugin_platform_interface] - image_picker_windows 0.2.1+1 [file_selector_platform_interface file_selector_windows flutter image_picker_platform_interface] - io 1.0.4 [meta path string_scanner] - js 0.6.7 [meta] - json_annotation 4.8.1 [meta] - lints 2.1.1 - logging 1.2.0 - matcher 0.12.16 [async meta stack_trace term_glyph test_api] - material_color_utilities 0.5.0 [collection] - meta 1.9.1 - mime 1.0.4 - nested 1.0.0 [flutter] - octo_image 2.0.0 [flutter] - package_config 2.1.0 [path] - package_info_plus 4.2.0 [ffi flutter flutter_web_plugins http meta path package_info_plus_platform_interface win32] - package_info_plus_platform_interface 2.0.1 [flutter meta plugin_platform_interface] - path_provider 2.1.1 [flutter path_provider_android path_provider_foundation path_provider_linux path_provider_platform_interface path_provider_windows] - path_provider_android 2.2.0 [flutter path_provider_platform_interface] - path_provider_foundation 2.3.1 [flutter path_provider_platform_interface] - path_provider_linux 2.2.1 [ffi flutter path path_provider_platform_interface xdg_directories] - path_provider_platform_interface 2.1.1 [flutter platform plugin_platform_interface] - path_provider_windows 2.2.1 [ffi flutter path path_provider_platform_interface win32] - petitparser 5.4.0 [meta] - platform 3.1.3 - plugin_platform_interface 2.1.6 [meta] - pointycastle 3.7.3 [collection convert js] - pool 1.5.1 [async stack_trace] - provider 6.0.5 [collection flutter nested] - pub_semver 2.1.4 [collection meta] - pubspec_parse 1.2.3 [checked_yaml collection json_annotation pub_semver yaml] - rxdart 0.27.7 - shared_preferences_android 2.2.1 [flutter shared_preferences_platform_interface] - shared_preferences_foundation 2.3.4 [flutter shared_preferences_platform_interface] - shared_preferences_linux 2.3.2 [file flutter path path_provider_linux path_provider_platform_interface shared_preferences_platform_interface] - shared_preferences_platform_interface 2.3.1 [flutter plugin_platform_interface] - shared_preferences_web 2.2.1 [flutter flutter_web_plugins shared_preferences_platform_interface] - shared_preferences_windows 2.3.2 [file flutter path path_provider_platform_interface path_provider_windows shared_preferences_platform_interface] - shelf 1.4.1 [async collection http_parser path stack_trace stream_channel] - shelf_web_socket 1.0.4 [shelf stream_channel web_socket_channel] - sky_engine 0.0.99 - smart_auth 1.1.1 [flutter flutter_web_plugins] - source_span 1.10.0 [collection path term_glyph] - sprintf 7.0.0 - sqflite 2.3.0 [flutter sqflite_common path] - sqflite_common 2.5.0 [synchronized path meta] - stack_trace 1.11.0 [path] - stream_channel 2.1.1 [async] - stream_transform 2.1.0 - string_scanner 1.2.0 [source_span] - syncfusion_flutter_core 23.1.41 [vector_math flutter] - syncfusion_flutter_pdf 23.1.41 [flutter intl xml syncfusion_flutter_core crypto convert] - syncfusion_flutter_signaturepad 23.1.41 [flutter syncfusion_flutter_core] - syncfusion_pdfviewer_macos 23.1.41 [flutter syncfusion_pdfviewer_platform_interface] - syncfusion_pdfviewer_platform_interface 23.1.41 [flutter plugin_platform_interface] - syncfusion_pdfviewer_web 23.1.41 [flutter flutter_web_plugins js meta syncfusion_pdfviewer_platform_interface] - syncfusion_pdfviewer_windows 23.1.41 [flutter] - synchronized 3.1.0 - term_glyph 1.2.1 - test_api 0.6.0 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph] - timezone 0.9.2 [path] - timing 1.0.1 [json_annotation] - typed_data 1.3.2 [collection] - universal_io 2.2.2 [collection meta typed_data] - universal_platform 1.0.0+1 - url_launcher 6.1.14 [flutter url_launcher_android url_launcher_ios url_launcher_linux url_launcher_macos url_launcher_platform_interface url_launcher_web url_launcher_windows] - url_launcher_android 6.1.0 [flutter url_launcher_platform_interface] - url_launcher_ios 6.1.5 [flutter url_launcher_platform_interface] - url_launcher_linux 3.0.6 [flutter url_launcher_platform_interface] - url_launcher_macos 3.0.7 [flutter url_launcher_platform_interface] - url_launcher_platform_interface 2.1.5 [flutter plugin_platform_interface] - url_launcher_web 2.0.20 [flutter flutter_web_plugins url_launcher_platform_interface] - url_launcher_windows 3.0.8 [flutter url_launcher_platform_interface] - uuid 4.1.0 [crypto sprintf] - vector_math 2.1.4 - visibility_detector 0.4.0+2 [flutter] - watcher 1.1.0 [async path] - web 0.1.4-beta - web_socket_channel 2.4.0 [async crypto stream_channel] - webview_flutter 4.4.1 [flutter webview_flutter_android webview_flutter_platform_interface webview_flutter_wkwebview] - webview_flutter_android 3.12.0 [flutter webview_flutter_platform_interface] - webview_flutter_platform_interface 2.6.0 [flutter meta plugin_platform_interface] - webview_flutter_wkwebview 3.9.1 [flutter path webview_flutter_platform_interface] - win32 5.0.9 [ffi] - win32_registry 1.1.2 [ffi win32] - xdg_directories 1.0.3 [meta path] - xml 6.3.0 [collection meta petitparser] - yaml 3.1.2 [collection source_span string_scanner] ```

freddirkse commented 1 year ago

I am having the same issue - the app builds fine for Android, and hot reloads work fine, but hot restarts cause the app to hang on:

try {
      await Firebase.initializeApp(
          options: DefaultFirebaseOptions.currentPlatform);
} catch (e) {
    print('firebase failed');
}

No exceptions, no crash, just stops. IDE is still responsive, but emulator is not. Only option to do anything is to rebuild and repeat.

Flutter doctor:

[√] Flutter (Channel stable, 3.13.8, on Microsoft Windows [Version 10.0.19045.3324], locale en-US)
    • Flutter version 3.13.8 on channel stable
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 6c4930c4ac (10 days ago), 2023-10-18 10:57:55 -0500
    • Engine revision 767d8c75e8
    • Dart version 3.1.4
    • DevTools version 2.25.0

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at ~\Android\Sdk\
    • Platform android-UpsideDownCakePrivacySandbox, build-tools 34.0.0
    • Java binary at: ~\Android\Android Studio 1\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-10027231)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at ~\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop Windows apps (Visual Studio Community 2019 16.6.2)
    • Visual Studio at ~\Microsoft Visual Studio\2019\Community
    • Visual Studio Community 2019 version 16.6.30204.135
    • Windows 10 SDK version 10.0.19041.0

[√] Android Studio (version 2022.1)
    • Android Studio at ~\Android\Android Studio
    • 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 11.0.15+0-b2043.56-9505619)

[√] Android Studio (version 2022.3)
    • Android Studio at ~\Android\Android Studio 1
    • 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 17.0.6+0-b2043.56-10027231)

[√] VS Code (version 1.79.0)
    • VS Code at ~\Microsoft VS Code
    • Flutter extension can be installed from:
       https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[√] Connected device (4 available)
    • sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64    • Android 14 (API 34) (emulator)
    • Windows (desktop)            • windows       • windows-x64    • Microsoft Windows [Version 10.0.19045.3324]
    • Chrome (web)                 • chrome        • web-javascript • Google Chrome 118.0.5993.72
    • Edge (web)                   • edge          • web-javascript • Microsoft Edge 118.0.2088.61

[√] Network resources
    • All expected network resources are available.

Dependencies:

Dart SDK 3.1.4
Flutter SDK 3.13.8

dependencies:
- cloud_firestore 4.12.1 [cloud_firestore_platform_interface cloud_firestore_web collection firebase_core firebase_core_platform_interface flutter meta]
- cupertino_icons 1.0.6
- firebase_analytics 10.6.2 [firebase_analytics_platform_interface firebase_analytics_web firebase_core firebase_core_platform_interface flutter]
- firebase_auth 4.12.0 [firebase_auth_platform_interface firebase_auth_web firebase_core firebase_core_platform_interface flutter meta]
- firebase_core 2.20.0 [firebase_core_platform_interface firebase_core_web flutter meta]
- firebase_crashlytics 3.4.2 [firebase_core firebase_core_platform_interface firebase_crashlytics_platform_interface flutter stack_trace]
- firebase_database 10.3.2 [firebase_core firebase_core_platform_interface firebase_database_platform_interface firebase_database_web flutter]
- flutter 0.0.0 [characters collection material_color_utilities meta vector_math web sky_engine]
- flutter_lorem 2.0.0 [flutter]
- flutter_spinkit 5.2.0 [flutter]
- flutter_typeahead 4.8.0 [flutter flutter_keyboard_visibility pointer_interceptor]
- focus_detector 2.0.1 [flutter visibility_detector]
- font_awesome_flutter 10.6.0 [flutter]
- get 4.6.6 [flutter]
- get_storage 2.1.1 [flutter get path_provider]
- json_annotation 4.8.1 [meta]
- lottie 2.7.0 [archive flutter path vector_math]
- modal_progress_hud_nsn 0.4.0 [flutter flutter_web_plugins plugin_platform_interface]
- open_file 3.3.2 [flutter ffi]
- package_info_plus 4.2.0 [ffi flutter flutter_web_plugins http meta path package_info_plus_platform_interface win32]
- path_provider 2.1.1 [flutter path_provider_android path_provider_foundation path_provider_linux path_provider_platform_interface path_provider_windows]
- permission_handler 11.0.1 [flutter meta permission_handler_android permission_handler_apple permission_handler_windows permission_handler_platform_interface]
- provider 6.0.5 [collection flutter nested]
- purchases_flutter 6.1.0 [flutter freezed_annotation json_annotation]
- signature 5.4.0 [flutter flutter_svg image]
- sliding_switch 1.1.0 [flutter]
- syncfusion_flutter_pdf 23.1.42 [flutter intl xml syncfusion_flutter_core crypto convert]
- talker_flutter 3.5.3 [flutter talker group_button path_provider share_plus]
- url_launcher 6.2.1 [flutter url_launcher_android url_launcher_ios url_launcher_linux url_launcher_macos url_launcher_platform_interface url_launcher_web url_launcher_windows]
- uuid 4.1.0 [crypto sprintf]

dev dependencies:
- build_runner 2.4.6 [analyzer args async build build_config build_daemon build_resolvers build_runner_core code_builder collection crypto dart_style frontend_server_client glob graphs http_multi_server io js logging meta mime package_config path pool pub_semver pubspec_parse shelf shelf_web_socket stack_trace stream_transform timing watcher web_socket_channel yaml]
- flutter_launcher_icons 0.13.1 [args checked_yaml cli_util image json_annotation path yaml]
- flutter_test 0.0.0 [flutter test_api matcher path fake_async clock stack_trace vector_math async boolean_selector characters collection material_color_utilities meta source_span stream_channel string_scanner term_glyph web]
- json_serializable 6.7.1 [analyzer async build build_config collection json_annotation meta path pub_semver pubspec_parse source_gen source_helper]

transitive dependencies:
- _fe_analyzer_shared 64.0.0 [meta]
- _flutterfire_internals 1.3.10 [collection firebase_core firebase_core_platform_interface flutter meta]
- analyzer 6.2.0 [_fe_analyzer_shared collection convert crypto glob meta package_config path pub_semver source_span watcher yaml]
- ansicolor 2.0.2
- archive 3.4.6 [crypto path pointycastle]
- args 2.4.2
- async 2.11.0 [collection meta]
- boolean_selector 2.1.1 [source_span string_scanner]
- build 2.4.1 [analyzer async convert crypto glob logging meta package_config path]
- build_config 1.1.1 [checked_yaml json_annotation path pubspec_parse yaml]
- build_daemon 4.0.0 [built_collection built_value http_multi_server logging path pool shelf shelf_web_socket stream_transform watcher web_socket_channel]
- build_resolvers 2.4.1 [analyzer async build collection convert crypto graphs logging package_config path pool pub_semver stream_transform yaml]
- build_runner_core 7.2.11 [async build build_config build_resolvers collection convert crypto glob graphs json_annotation logging meta package_config path pool timing watcher yaml]
- built_collection 5.1.1
- built_value 8.6.3 [built_collection collection fixnum meta]
- characters 1.3.0
- checked_yaml 2.0.3 [json_annotation source_span yaml]
- cli_util 0.4.0 [meta path]
- clock 1.1.1
- cloud_firestore_platform_interface 6.0.2 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface]
- cloud_firestore_web 3.8.2 [_flutterfire_internals cloud_firestore_platform_interface collection firebase_core firebase_core_web flutter flutter_web_plugins js]
- code_builder 4.7.0 [built_collection built_value collection matcher meta]
- collection 1.17.2
- convert 3.1.1 [typed_data]
- cross_file 0.3.3+6 [js meta]
- crypto 3.0.3 [typed_data]
- dart_style 2.3.3 [analyzer args path pub_semver source_span]
- fake_async 1.3.1 [clock collection]
- ffi 2.1.0
- file 7.0.0 [meta path]
- firebase_analytics_platform_interface 3.7.4 [_flutterfire_internals firebase_core flutter meta plugin_platform_interface]
- firebase_analytics_web 0.5.5+4 [_flutterfire_internals firebase_analytics_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins js]
- firebase_auth_platform_interface 7.0.2 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface]
- firebase_auth_web 5.8.5 [firebase_auth_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins http_parser js meta]
- firebase_core_platform_interface 5.0.0 [collection flutter flutter_test meta plugin_platform_interface]
- firebase_core_web 2.8.1 [firebase_core_platform_interface flutter flutter_web_plugins js meta]
- firebase_crashlytics_platform_interface 3.6.10 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface]
- firebase_database_platform_interface 0.2.5+10 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface]
- firebase_database_web 0.2.3+10 [firebase_core firebase_core_web firebase_database_platform_interface flutter flutter_web_plugins js]
- fixnum 1.1.0
- flutter_keyboard_visibility 5.4.1 [meta flutter_keyboard_visibility_platform_interface flutter_keyboard_visibility_linux flutter_keyboard_visibility_macos flutter_keyboard_visibility_web flutter_keyboard_visibility_windows flutter]
- flutter_keyboard_visibility_linux 1.0.0 [flutter_keyboard_visibility_platform_interface flutter]
- flutter_keyboard_visibility_macos 1.0.0 [flutter_keyboard_visibility_platform_interface flutter]
- flutter_keyboard_visibility_platform_interface 2.0.0 [flutter meta plugin_platform_interface]
- flutter_keyboard_visibility_web 2.0.0 [flutter_keyboard_visibility_platform_interface flutter_web_plugins flutter]
- flutter_keyboard_visibility_windows 1.0.0 [flutter_keyboard_visibility_platform_interface flutter]
- flutter_svg 2.0.8 [flutter vector_graphics vector_graphics_codec vector_graphics_compiler]
- flutter_web_plugins 0.0.0 [flutter characters collection material_color_utilities meta vector_math web]
- freezed_annotation 2.4.1 [collection json_annotation meta]
- frontend_server_client 3.2.0 [async path]
- glob 2.1.2 [async collection file path string_scanner]
- graphs 2.3.1 [collection]
- group_button 5.3.3 [flutter]
- http 1.1.0 [async http_parser meta]
- http_multi_server 3.2.1 [async]
- http_parser 4.0.2 [collection source_span string_scanner typed_data]
- image 4.1.3 [archive meta xml]
- intl 0.18.1 [clock meta path]
- io 1.0.4 [meta path string_scanner]
- js 0.6.7 [meta]
- logging 1.2.0
- matcher 0.12.16 [async meta stack_trace term_glyph test_api]
- material_color_utilities 0.5.0 [collection]
- meta 1.9.1
- mime 1.0.4
- nested 1.0.0 [flutter]
- package_config 2.1.0 [path]
- package_info_plus_platform_interface 2.0.1 [flutter meta plugin_platform_interface]
- path 1.8.3
- path_parsing 1.0.1 [vector_math meta]
- path_provider_android 2.2.1 [flutter path_provider_platform_interface]
- path_provider_foundation 2.3.1 [flutter path_provider_platform_interface]
- path_provider_linux 2.2.1 [ffi flutter path path_provider_platform_interface xdg_directories]
- path_provider_platform_interface 2.1.1 [flutter platform plugin_platform_interface]
- path_provider_windows 2.2.1 [ffi flutter path path_provider_platform_interface win32]
- permission_handler_android 11.1.0 [flutter permission_handler_platform_interface]
- permission_handler_apple 9.1.4 [flutter permission_handler_platform_interface]
- permission_handler_platform_interface 3.12.0 [flutter meta plugin_platform_interface]
- permission_handler_windows 0.1.3 [flutter permission_handler_platform_interface]
- petitparser 5.4.0 [meta]
- platform 3.1.3
- plugin_platform_interface 2.1.6 [meta]
- pointer_interceptor 0.9.3+6 [flutter]
- pointycastle 3.7.3 [collection convert js]
- pool 1.5.1 [async stack_trace]
- pub_semver 2.1.4 [collection meta]
- pubspec_parse 1.2.3 [checked_yaml collection json_annotation pub_semver yaml]
- share_plus 7.2.1 [cross_file meta mime flutter flutter_web_plugins share_plus_platform_interface file url_launcher_web url_launcher_windows url_launcher_linux url_launcher_platform_interface ffi win32]
- share_plus_platform_interface 3.3.1 [cross_file flutter meta mime plugin_platform_interface path_provider uuid]
- shelf 1.4.1 [async collection http_parser path stack_trace stream_channel]
- shelf_web_socket 1.0.4 [shelf stream_channel web_socket_channel]
- sky_engine 0.0.99
- source_gen 1.4.0 [analyzer async build dart_style glob path source_span yaml]
- source_helper 1.3.4 [analyzer collection source_gen]
- source_span 1.10.0 [collection path term_glyph]
- sprintf 7.0.0
- stack_trace 1.11.0 [path]
- stream_channel 2.1.1 [async]
- stream_transform 2.1.0
- string_scanner 1.2.0 [source_span]
- syncfusion_flutter_core 23.1.42 [vector_math flutter]
- talker 3.1.4 [talker_logger]
- talker_logger 3.1.0 [ansicolor]
- term_glyph 1.2.1
- test_api 0.6.0 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph]
- timing 1.0.1 [json_annotation]
- typed_data 1.3.2 [collection]
- url_launcher_android 6.2.0 [flutter url_launcher_platform_interface]
- url_launcher_ios 6.2.0 [flutter url_launcher_platform_interface]
- url_launcher_linux 3.1.0 [flutter url_launcher_platform_interface]
- url_launcher_macos 3.1.0 [flutter url_launcher_platform_interface]
- url_launcher_platform_interface 2.2.0 [flutter plugin_platform_interface]
- url_launcher_web 2.2.0 [flutter flutter_web_plugins url_launcher_platform_interface]
- url_launcher_windows 3.1.0 [flutter url_launcher_platform_interface]
- vector_graphics 1.1.9+1 [flutter vector_graphics_codec]
- vector_graphics_codec 1.1.9+1
- vector_graphics_compiler 1.1.9+1 [args meta path_parsing xml vector_graphics_codec path]
- vector_math 2.1.4
- visibility_detector 0.2.2 [flutter]
- watcher 1.1.0 [async path]
- web 0.1.4-beta
- web_socket_channel 2.4.0 [async crypto stream_channel]
- win32 5.0.9 [ffi]
- xdg_directories 1.0.3 [meta path]
- xml 6.3.0 [collection meta petitparser]
- yaml 3.1.2 [collection source_span string_scanner]
mariopepe commented 1 year ago

Solution that worked for me: 🙏🏻

Having the same issue, and solved by downgrading all the flutterfire packages to before they were using pigeon. Since the introduction of pigeon in flutterfire codebase (I could find their first commits starting 25/30 days ago) a huge number of bugs started to appear, also in relation to firebase storage and emulator, and authentication and emulator (see for instance this). I think this could be due to one or multiple of the following reasons:

  1. pigeon is fundamentally broken or beta stage software
  2. The team at Flutterfire did not fully understand the implications of bringing pigeon in the complex firebase ecosystem
  3. They did not implement sufficient tests to catch for these errors (this is a fact)

Anyway, I changed my dependencies to the ones below and solved, hope it helps you guys!

Remember not to use the caret ^ operator!! The buggy versions of the plugin are marked as non breaking changes, so if you downgrade the package in pubspec.yaml, but keep the caret operator, you are basically still getting the most recent (and buggy) versions!

  cloud_firestore: 4.9.3
  cloud_functions: 4.4.2
  firebase_analytics: 10.5.1
  firebase_auth: 4.10.1
  firebase_core: 2.17.0
  firebase_crashlytics: 3.3.7
  firebase_dynamic_links: 5.3.7
  firebase_in_app_messaging: 0.7.3+7
  firebase_messaging: 14.6.9
  firebase_remote_config: 4.2.7
  firebase_storage: 11.2.8
russellwheatley commented 1 year ago

@M-Yahia2011 @freddirkse I think your freeze is coming from firestore which was fixed and released in the latest version. I'd encourage you to upgrade your dependencies to the latest versions.

firebase_core: ^2.20.0
cloud_firestore: ^4.12.1
...

Alternatively, you could run flutterfire update in your project to update all FlutterFire dependencies to latest.

freddirkse commented 1 year ago

@M-Yahia2011 @freddirkse I think your freeze is coming from firestore which was fixed and released in the latest version. I'd encourage you to upgrade your dependencies to the latest versions.

firebase_core: ^2.20.0
cloud_firestore: ^4.12.1
...

I was running the updated versions (see my dependencies post above). This is apparently what was causing the freeze up.

I can confirm that downgrading to the versions posted by @mariopepe has resolved the issue for me for now (thank you @mariopepe).

google-oss-bot commented 12 months ago

Hey @M-Yahia2011. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 7 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

google-oss-bot commented 11 months ago

Since there haven't been any recent updates here, I am going to close this issue.

@M-Yahia2011 if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.

M-Yahia2011 commented 11 months ago

@M-Yahia2011 @freddirkse I think your freeze is coming from firestore which was fixed and released in the latest version. I'd encourage you to upgrade your dependencies to the latest versions.

firebase_core: ^2.20.0
cloud_firestore: ^4.12.1
...

I was running the updated versions (see my dependencies post above). This is apparently what was causing the freeze up.

I can confirm that downgrading to the versions posted by @mariopepe has resolved the issue for me for now (thank you @mariopepe).

Thank you, the latest update really solved the problem