queryWithFilters method
Used to return Songs Info based in Something. Works like a "Search".
Parameters:
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
args
is null, will be set to Title orName
. - If Android >= Q/10
artwork
will return null, in this case, it's necessary use queryArtwork.
Platforms:
Android | IOS | Web |
---|---|---|
✔️ |
✔️ |
✔️ |
See more about platforms support
Implementation
@override
Future<List<dynamic>> queryWithFilters(
String argsVal,
WithFiltersType withType,
dynamic args,
) async {
final List<dynamic> resultFilters = await _channel.invokeMethod(
"queryWithFilters",
{"withType": withType.index, "args": args.index ?? 0, "argsVal": argsVal},
);
return resultFilters;
}