convertFlutterSurfaceToImage method Null safety

  1. @override
Future<void> convertFlutterSurfaceToImage()
override

Android only. Converts the Flutter surface to an image view.

Implementation

@override
Future<void> convertFlutterSurfaceToImage() async {
  if (!Platform.isAndroid) {
    // No-op on other platforms.
    return;
  }
  assert(!_isSurfaceRendered, 'Surface already converted to an image');
  await integrationTestChannel.invokeMethod<void>(
    'convertFlutterSurfaceToImage',
  );
  _isSurfaceRendered = true;

  addTearDown(() async {
    assert(_isSurfaceRendered, 'Surface is not an image');
    await integrationTestChannel.invokeMethod<void>(
      'revertFlutterImage',
    );
    _isSurfaceRendered = false;
  });
}