facebookSharePhotos static method Null safety

Future<String?> facebookSharePhotos(
  1. {required List<String> paths,
  2. OnSuccessHandler? onSuccess,
  3. OnCancelHandler? onCancel,
  4. OnErrorHandler? onError}
)

Implementation

static Future<String?> facebookSharePhotos({
  required List<String> paths,
  OnSuccessHandler? onSuccess,
  OnCancelHandler? onCancel,
  OnErrorHandler? onError,
}) async {
  _channel.setMethodCallHandler((MethodCall call) async {
    switch (call.method) {
      case "onSuccess":
        if (onSuccess != null){
          return onSuccess(call.arguments);
        }
        break;
      case "onCancel":
        if (onCancel != null) {
          return onCancel();
        }
        break;
      case "onError":
      if (onError != null) {
        return onError(call.arguments);
      }
      break;
      default:
        throw UnsupportedError("Unknown method called");
    }
    return call.arguments;
  });
  return _channel.invokeMethod<String>('facebookSharePhotos', <String, dynamic>{
    'paths': paths,
  });
}