getAlbums static method
Implementation
static Future<List<Album>?> getAlbums({
List<MediaType> types = const <MediaType>[MediaType.image, MediaType.video],
}) async {
bool hasPermission = await checkPermission();
if (!hasPermission) return null;
final List<dynamic> images = await _channel.invokeMethod(
'getAlbums',
{
'types': types
.map((e) => e.toString().replaceAll("MediaType.", "").toUpperCase())
.join("-")
},
);
List<Album> albums = <Album>[];
for (var element in images) {
albums.add(Album.fromJson(element));
}
return albums;
}