save method

  1. @override
Future<PickedEntry?> save(
  1. FilegateSaveOptions options
)
override

Implementation

@override
Future<PickedEntry?> save(FilegateSaveOptions options) async {
  if (options.suggestedName.trim().isEmpty) {
    throw ArgumentError.value(
      options.suggestedName,
      'suggestedName',
      'suggestedName must not be empty',
    );
  }
  if (options.suggestedName.contains('/') ||
      options.suggestedName.contains(r'\')) {
    throw ArgumentError.value(
      options.suggestedName,
      'suggestedName',
      'suggestedName must be a file name, not a path',
    );
  }

  final entry = await methodChannel.invokeMapMethod<Object?, Object?>(
    'save',
    options.toMap(),
  );

  if (entry == null) {
    return null;
  }

  return PickedEntry.fromMap(entry);
}