removeAfter static method
Implementation
@Deprecated('This class is deprecated use [remove]')
static void removeAfter(
Future<void> Function(BuildContext) initializeFunction,
) {
final binding = WidgetsFlutterBinding.ensureInitialized();
// Prevents app from closing splash screen, app layout will be build but not displayed.
binding.deferFirstFrame();
binding.addPostFrameCallback((_) async {
final BuildContext? context = binding.renderViewElement;
if (context != null) {
// Run any sync or awaited async function you want to wait for before showing app layout
await initializeFunction.call(context);
}
// Closes splash screen, and show the app layout.
binding.allowFirstFrame();
if (kIsWeb) {
remove();
}
});
}