setVirtualBackground method

  1. @override
void setVirtualBackground(
  1. String imagePath,
  2. dynamic errorCallback(
    1. int code,
    2. String message
    )?
)
override

Implementation

@override
void setVirtualBackground(String imagePath, Function(int code, String message)? errorCallback) async {
  try {
    if (!kIsWeb && (Platform.isIOS || Platform.isAndroid)) {
      await methodChannel.invokeMethod("setVirtualBackground", {'imagePath': imagePath});
    } else {
      errorCallback!(-1, 'This platform is not supported');
    }
  } on PlatformException catch (error) {
    errorCallback!(int.fromEnvironment(error.code), error.message!);
  } on Exception catch (error) {
    errorCallback!(-1, error.toString());
  }
}