An issue in the below code is that the code produces a black screen because the splash screen is removed with the FlutterNativeSplash.remove() command before the app is ready to be built. In this case, the reason the app is not ready to be built is because if the await Future. Delayed, but in another app, the same effect could be caused by waiting for resources to load, waiting for a server response, etc.

void main() {
  WidgetsBinding widgetsBinding = WidgetsFlutterBinding.ensureInitialized();
  FlutterNativeSplash.preserve(widgetsBinding: widgetsBinding);
  HttpOverrides.global = new MyHttpOverrides();
  runApp(const MyApp());
}

Solution
It is important to remove the splash screen only when the screen is ready to be built. The example app in this package shows a good way to implement this. For the simplistic example above, the black screen can be removed simply by moving the FlutterNativeSplash.remove() after the delay to the point where the app is ready to be built:

 Future<void> main() async {
  WidgetsBinding widgetsBinding = WidgetsFlutterBinding.ensureInitialized();
  FlutterNativeSplash.preserve(widgetsBinding: widgetsBinding);
  await Future.delayed(const Duration(milliseconds: 3000), () {});
  FlutterNativeSplash.remove();
  runApp(const MyApp());
}

Github Closed issue mentioned the solution for the same issue by the owner of this library.

Support On Demand!

Flutter