scanMedia method
Used to scan the given path
Will return:
- A boolean indicating if the path was scanned or not.
Usage:
- When using the
Android
platform. After deleting a media using the dart:io, call this method to update the media. If the media was successfully and the path not scanned. Will keep showing on querySongs.
Example:
OnAudioQuery _audioQuery = OnAudioQuery();
File file = File('path');
try {
if (file.existsSync()) {
file.deleteSync();
_audioQuery.scanMedia(file.path); // Scan the media 'path'
}
} catch (e) {
debugPrint('$e');
}
Platforms:
Android | IOS | Web |
---|---|---|
✔️ |
❌ |
❌ |
See more about platforms support
Implementation
Future<bool> scanMedia(String path) async {
return await platform.scanMedia(path);
}