queryWithFilters method Null safety

Future<List> queryWithFilters(
  1. String argsVal,
  2. WithFiltersType withType,
  3. {dynamic args}
)

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. See Example1.

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 or Name.
  • If Android >= Q/10 artwork will return null, in this case, it's necessary use queryArtwork.

Platforms:

AndroidIOSWeb
✔️✔️✔️

See more about platforms support

Implementation

Future<List<dynamic>> queryWithFilters(
  String argsVal,
  WithFiltersType withType, {
  dynamic args,
}) async {
  return platform.queryWithFilters(
    argsVal,
    withType,
    args ?? _getArgs(withType),
  );
}