readMetadata method
Reads metadata from the file at filePath.
When createThumbnail is true and the file is a video with no
embedded artwork, a thumbnail is generated from a video frame (see
MediaMetadata.read for details).
Returns a Metadata object, or null if the file cannot be read.
Implementation
@override
Future<Metadata?> readMetadata(String filePath, {bool createThumbnail = false}) async {
try {
final result = await methodChannel.invokeMethod<Map>(
'readMetadata',
{'filePath': filePath, 'createThumbnail': createThumbnail},
);
if (result == null) return null;
return Metadata.fromMap(result);
} on PlatformException catch (e) {
debugPrint('[media_metadata] PlatformException: ${e.message}');
return null;
}
}