search method
Future<MediaData?>
search({
- required String tagJson,
- required String type,
- required String page,
- required String pageSize,
- bool addedToLibrary = false,
override
Implementation
@override
Future<MediaData?> search({
required String tagJson,
required String type,
required String page,
required String pageSize,
bool addedToLibrary = false,
}) async {
try {
final result = await methodChannel.invokeMethod<String>('search', {
'tag': tagJson,
'type': type,
'page': page,
'pageSize': pageSize,
'isLibrary': addedToLibrary,
});
if (result == null) {
return null;
}
final jsonMap = jsonDecode(result) as Map<String, dynamic>;
return MediaData.fromJson(jsonMap);
} on PlatformException catch (e) {
throw PlatformException(
code: 'SEARCH_ERROR',
message: 'Failed to search media: $e',
details: e.toString(),
);
}
}