querySongsBy method
Future<List<SongModel> >
querySongsBy(
- SongsByType songsByType,
- List<
Object> values, [ - UriType? uriType,
- bool? requestPermission,
Used to return Songs Info based in SongModel.
This method will search every single music based in some value from SongsByType.
Parameters:
requestPermission
is used for request or no Android STORAGE PERMISSION.songsByType
is used to define a value that will be used to find the music.uriType
is used to define if songs will be catch inEXTERNAL
orINTERNAL
storage.values
is used to define the value to find every music.
Important:
- If
requestPermission
is null, will be set tofalse
. - If
uriType
is null, will be set toEXTERNAL
.
Implementation
Future<List<SongModel>> querySongsBy(
SongsByType songsByType,
List<Object> values, [
UriType? uriType,
bool? requestPermission,
]) async {
List<String> valuesConverted = [];
values.forEach((element) {
valuesConverted.add(element.toString());
});
final List<dynamic> resultSongs =
await _channel.invokeMethod("querySongsBy", {
"requestPermission": _checkPermission(requestPermission),
"by": songsByType.index,
"uri": uriType != null ? uriType.index : UriType.EXTERNAL.index,
"values": valuesConverted
});
return resultSongs.map((songInfo) => SongModel(songInfo)).toList();
}