Skip to content

WidgetsFlutterBinding.ensureInitialized() takes down splash screen too early. #39494

@goderbauer

Description

@goderbauer

In #38464 we changed it to require a call to WidgetsFlutterBinding.ensureInitialized before your runApp if you want to access method channels. Unfortunately, this means that the native splash screen gets taken down too early and a black screen is shown. Repro-case:

import 'package:flutter/material.dart';
import 'dart:async';

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  Timer(Duration(seconds: 10), () {
    runApp(Placeholder());
  });
}

(Instead of running a timer, a real app may wait for data from the native side before calling runApp).

Metadata

Metadata

Assignees

Labels

c: regressionIt was better in the past than it is nowcustomer: crowdAffects or could affect many people, though not necessarily a specific customer.engineflutter/engine related. See also e: labels.frameworkflutter/packages/flutter repository. See also f: labels.platform-iosiOS applications specifically

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions