flutter_native_splash icon indicating copy to clipboard operation
flutter_native_splash copied to clipboard

Splash Screen Stuck after usage of the application in some cases

Open Samrakk opened this issue 9 months ago • 1 comments

Describe the bug

The app is freezing on the native splash screen. After reviewing session recordings in the Smartlook tool, I’ve observed that, following a few sessions, certain customers encounter a persistent hang on the native splash screen.

Configuration

dependencies:
  flutter:
    sdk: flutter
  components:
    path: ../components

  app_links: ^3.4.5
  flutter_native_splash: ^2.4.4
  flutter_smartlook: ^4.1.25

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^1.0.2

dev_dependencies:
  integration_test:
    sdk: flutter
  flutter_test:
    sdk: flutter
  flutter_driver:
    sdk: flutter
  test: ^1.24.3

# flutter_native_splash-development.yaml
flutter_native_splash:
  color: "#0077FF"
  color_dark: "#0077FF"
  image: assets/images/logo.png

  android_12:
    icon_background_color: "#0077FF"
    icon_background_color_dark: "#0077FF"
    image: assets/images/splash12.png

  web: false

main.dart

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await initializeApp(); // Avoid excessive delays
  FlutterNativeSplash.remove();
  await Firebase.initializeApp();
  WidgetsBinding.instance.addPostFrameCallback((_) {
    FlutterNativeSplash.remove();
    print("First frame rendered. Splash screen should be gone.");
  });

Device (please complete the following information): Device: [e.g. iPhone16, iPhone15] OS: [e.g. iOS8.1, iOS8.2, iOS8.3,]

To Reproduce Steps to reproduce the behavior, using the example app: I can catch this issue by using SmarLook. Some customers are stuck in Splash Screen Directly.

The last sessions are stuck on the last sessions. Screenshots

Image

Samrakk avatar Mar 26 '25 10:03 Samrakk

Since you have not made a call to FlutterNativeSplash.preserve, it is not necessary to make a call to FlutterNativeSplash.remove(). You should remove those calls to .remove(). If your users are still experiencing being stuck on the splash screen after correcting this, it would be due to your app locking up before Flutter can render the first frame, automatically removing the splash screen.

jonbhanson avatar Apr 06 '25 14:04 jonbhanson