iosCreateAlbum method

Future<AssetPathEntity> iosCreateAlbum(
  1. String name,
  2. bool isRoot,
  3. AssetPathEntity? parent
)
inherited

Implementation

Future<AssetPathEntity> iosCreateAlbum(
  String name,
  bool isRoot,
  AssetPathEntity? parent,
) async {
  assert(Platform.isIOS || Platform.isMacOS);
  final Map<String, dynamic> map = <String, dynamic>{
    'name': name,
    'isRoot': isRoot,
  };
  if (!isRoot && parent != null) {
    map['folderId'] = parent.id;
  }
  final Map result = await _channel.invokeMethod(
    PMConstants.mCreateAlbum,
    map,
  );
  if (result['errorMsg'] != null) {
    throw PlatformException(
      code: PMConstants.mCreateAlbum,
      message: result['errorMsg'],
    );
  }
  return AssetPathEntity.fromId(result['id'] as String);
}