createFlutterWorld method Null safety

Future<FlutterWorld> createFlutterWorld(
  1. TestConfiguration config,
  2. FlutterWorld? world
)

Implementation

Future<FlutterWorld> createFlutterWorld(
  TestConfiguration config,
  FlutterWorld? world,
) async {
  var flutterConfig = config as FlutterTestConfiguration;
  world = world ?? FlutterWorld();

  final driver = await createFlutterDriver(
    flutterConfig.runningAppProtocolEndpointUri != null &&
            flutterConfig.runningAppProtocolEndpointUri!.isNotEmpty
        ? flutterConfig.runningAppProtocolEndpointUri
        : null,
  );

  world.setFlutterDriver(driver);

  return world;
}