queryFromFolder method
Future<List<SongModel> >
queryFromFolder(
- String path, [
- SongSortType? sortType,
- OrderType? orderType,
- UriType? uriType,
- bool? requestPermission,
Used to return Songs Info from a specific Folder
based in SongModel.
Parameters:
path
is used to define where the plugin will search for audio.requestPermission
is used for request or no Android STORAGE PERMISSION.orderType
is used to define if order will be Ascending or Descending.sortType
is used to define list sort.uriType
is used to define if songs will be catch inEXTERNAL
orINTERNAL
storage.
Important:
- If
requestPermission
is null, will be set tofalse
. - If
orderType
is null, will be set toASC_OR_SMALLER
. - If
sortType
is null, will be set totitle
. - If
uriType
is null, will be set toEXTERNAL
. - If Android >= Q/10
artwork
will return null, in this case, it's necessary use queryArtworks.
Implementation
Future<List<SongModel>> queryFromFolder(
String path, [
SongSortType? sortType,
OrderType? orderType,
UriType? uriType,
bool? requestPermission,
]) async {
final List<dynamic> resultFromFolder =
await _channel.invokeMethod("queryFromFolder", {
"requestPermission": _checkPermission(requestPermission),
"sortType":
sortType != null ? sortType.index : SongSortType.DEFAULT.index,
"orderType": _checkOrder(orderType),
"uri": uriType != null ? uriType.index : UriType.EXTERNAL.index,
"path": path
});
return resultFromFolder.map((songInfo) => SongModel(songInfo)).toList();
}