Flutter app once I open the app in iOS freeze on the splashscreen


I’ve this downside. I’ve a flutter app which is related to firebase. After I run the app in launch mode with the iphone related it really works wonderful. The app present splashscreen and after that present the house or the login.
The issue seem once I shut/kill the app and I re-open it from the telephone. On this case the app is freezed within the splashscreen. The identical downside occur once I obtain the app from testflight. Somebody may help me to grasp which is the issue or a potential resolution? Or a solution to perceive the issue?

That is the code about the principle file:

import 'package deal:firebase_messaging/firebase_messaging.dart';
import 'package deal:flutter/materials.dart';
import 'package deal:device_preview/device_preview.dart';
import 'package deal:flutter/cupertino.dart';
import 'package deal:flutter_local_notifications/flutter_local_notifications.dart';
import 'package deal:flutter_statusbarcolor_ns/flutter_statusbarcolor_ns.dart';
import 'package deal:get/get.dart';
import 'package deal:google_fonts/google_fonts.dart';
import 'package deal:flutter_localizations/flutter_localizations.dart';
import 'app_colors.dart';
import 'residence/home_view.dart';
import 'main_binding.dart';
import 'app_pages.dart';
import 'locales.dart';

const BASE_URL = "https://aaa.bbb.com/api/v1"; // prod

Future<void> _firebaseMessagingBackgroundHandler(RemoteMessage message) async {
  await Firebase.initializeApp();
  print('Dealing with a background message ${message.messageId}');
}

const AndroidNotificationChannel channel = AndroidNotificationChannel(
  'notification_channel', // id
  'Machine Notifications', // title
  //'This channel is used for essential machine notifications.', // description
  significance: Significance.excessive,
);

last FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =
    FlutterLocalNotificationsPlugin();

void foremost() async {
  WidgetsFlutterBinding.ensureInitialized();

  await Firebase.initializeApp();

  FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler);

  await flutterLocalNotificationsPlugin
      .resolvePlatformSpecificImplementation<
          AndroidFlutterLocalNotificationsPlugin>()
      ?.createNotificationChannel(channel);

  await FirebaseMessaging.occasion.setForegroundNotificationPresentationOptions(
    alert: true,
    badge: true,
    sound: true,
  );

  String? tokenFBM = await FirebaseMessaging.occasion.getToken();
  print(tokenFBM);
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget construct(BuildContext context) {
    FlutterStatusbarcolor.setStatusBarColor(AppColors.primaryBlue);
    FlutterStatusbarcolor.setStatusBarWhiteForeground(true);
    FirebaseMessaging.occasion.requestPermission();

    FirebaseMessaging.onMessage.hear((RemoteMessage message) {
      RemoteNotification? notification = message.notification;
      AndroidNotification? android = message.notification?.android;
      if (notification != null && android != null) {
        flutterLocalNotificationsPlugin.present(
            notification.hashCode,
            notification.title,
            notification.physique,
            NotificationDetails(
              android: AndroidNotificationDetails(
                channel.id,
                channel.identify,
                //channel.description,
                icon: 'ic_stat_notification',
                coloration: AppColors.primaryBlue,
              ),
            ));
      }
    });


    return GetMaterialApp(
      locale: Get.deviceLocale,
      builder: DevicePreview.appBuilder,
      initialBinding: MainBinding(),
      debugShowCheckedModeBanner: false,
      localizationsDelegates: [
        GlobalMaterialLocalizations.delegate,
        GlobalWidgetsLocalizations.delegate,
        DefaultCupertinoLocalizations.delegate,
        GlobalCupertinoLocalizations.delegate,
      ],
      supportedLocales: [
        const Locale('it', ''),
      ],
      translations: AppTranslation(),
      initialRoute: HomeView.ROUTE,
      fallbackLocale: Locale('it'),
      theme: ThemeData(
        primaryColor: AppColors.primaryBlue,
        backgroundColor: Colours.white,
        brightness: Brightness.gentle,
        textTheme: GoogleFonts.poppinsTextTheme(Theme.of(context).textTheme),
      ),
      getPages: AppPages.getRoutes(),
      title: 'Title',
    );
  }
}```

That is flutter physician:
Physician abstract (to see all particulars, run flutter physician -v):
[✓] Flutter (Channel steady, 3.13.3, on macOS 13.1 22C65 darwin-arm64, locale en-GB)
[✓] Android toolchain - develop for Android units (Android SDK model 33.0.1)
[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
[✓] Chrome - develop for the net
[✓] Android Studio (model 2021.3)
[✓] Android Studio (model 2022.2)
[✓] Android Studio (model 2021.3)
[✓] IntelliJ IDEA Group Version (model 2022.3.2)
[✓] VS Code (model 1.77.3)
[✓] Related gadget (3 out there)
[✓] Community sources

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles