queryWithFilters method
Future<List>
queryWithFilters(
- String argsVal,
- WithFiltersType withType,
- dynamic args, [
- bool? requestPermission,
Used to return Songs Info based in Something. Works like a "Search".
Parameters:
requestPermission
is used for request or no Android STORAGE PERMISSION.withType
The type of search based in WithFiltersType.args
is used to define what you're looking for.argsVal
The "key".
Before you use:
- queryWithFilters implements all types based in WithFiltersType, this method return always a
dynamic
List. - After call this method you will need to specify the
Model
. SeeExample1
.
Example1:
//Using [FutureBuilder]
//I changed [>] to [-]
builder: (context, AsyncSnapshot-List-dynamic-- item) {
List-SongModel- = item.data!.map((e) => SongModel(e)).toList(); //Ex1
List-ArtistModel- = item.data!.map((e) => ArtistModel(e)).toList(); //Ex2
...}
Important:
- If
requestPermission
is null, will be set tofalse
. - If
args
is null, will be set to Title orName
. - If Android >= Q/10
artwork
will return null, in this case, it's necessary use queryArtworks.
Implementation
Future<List<dynamic>> queryWithFilters(
String argsVal,
WithFiltersType withType,
dynamic args, [
bool? requestPermission,
]) async {
final List<dynamic> resultFilters =
await _channel.invokeMethod("queryWithFilters", {
"requestPermission": _checkPermission(requestPermission),
"withType": withType.index,
"args": args.index ?? 0,
"argsVal": argsVal
});
return resultFilters;
}