Skip to content

Commit

Permalink
⚡️ Improve type promotions
Browse files Browse the repository at this point in the history
Fixes #1181
  • Loading branch information
AlexV525 committed Sep 15, 2024
1 parent 3bb7504 commit 9617dc1
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions lib/src/internal/plugin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ class PhotoManagerPlugin with BasePlugin, IosPlugin, AndroidPlugin, OhosPlugin {
hasAll = true;
}
filterOption ??= FilterOptionGroup();
final result = await _channel.invokeMethod<Map>(
final Map result = await _channel.invokeMethod(
PMConstants.mGetAssetPathList,
<String, dynamic>{
'type': type.value,
Expand All @@ -154,9 +154,6 @@ class PhotoManagerPlugin with BasePlugin, IosPlugin, AndroidPlugin, OhosPlugin {
'pathOption': pathFilterOption.toMap(),
},
);
if (result == null) {
return <AssetPathEntity>[];
}
return ConvertUtils.convertToPathList(
result.cast(),
type: type,
Expand Down Expand Up @@ -682,7 +679,7 @@ mixin IosPlugin on BasePlugin {
if (!videoFile.existsSync()) {
throw ArgumentError('The video file does not exists');
}
final result = await _channel.invokeMethod(
final Map result = await _channel.invokeMethod(
PMConstants.mSaveLivePhoto,
<String, dynamic>{
'imagePath': imageFile.absolute.path,
Expand Down Expand Up @@ -803,25 +800,19 @@ mixin AndroidPlugin on BasePlugin {
}

Future<List<String>> androidColumns() async {
final result = await _channel.invokeMethod(
final List result = await _channel.invokeMethod(
PMConstants.mColumnNames,
);
if (result is List<dynamic>) {
return result.map((e) => e.toString()).toList();
}
return result ?? <String>[];
return result.map((e) => e.toString()).toList();
}
}

mixin OhosPlugin on BasePlugin {
Future<List<String>> ohosColumns() async {
final result = await _channel.invokeMethod(
final List result = await _channel.invokeMethod(
PMConstants.mColumnNames,
);
if (result is List<dynamic>) {
return result.map((e) => e.toString()).toList();
}
return result ?? <String>[];
return result.map((e) => e.toString()).toList();
}
}

Expand Down

0 comments on commit 9617dc1

Please sign in to comment.