getDirectoryContents method
Gets contents of a specific directory by its path.
path
- The absolute path of the directory to scan.
Returns a List of Maps with file/folder details.
Example:
var contents = await MethodChannelMediaManager().getDirectoryContents('/storage/DCIM');
Implementation
@override
Future<List<Map<String, dynamic>>> getDirectoryContents(String path) async {
final List<dynamic> rawContents = await methodChannel.invokeMethod(
'getDirectoryContents',
{'path': path},
);
final List<Map<String, dynamic>> contents =
rawContents
.map((item) => Map<String, dynamic>.from(item as Map))
.toList();
return contents;
}