queryGenres method

Future<List<GenreModel>> queryGenres([
  1. GenreSortType? sortType,
  2. OrderType? orderType,
  3. UriType? uriType,
  4. bool? requestPermission,
])

Used to return Genres Info based in GenreModel.

Parameters:

  • 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 in EXTERNAL or INTERNAL storage.

Important:

  • If requestPermission is null, will be set to false.
  • If orderType is null, will be set to ASC_OR_SMALLER.
  • If sortType is null, will be set to GenreName.
  • If uriType is null, will be set to EXTERNAL.

Implementation

Future<List<GenreModel>> queryGenres([
  GenreSortType? sortType,
  OrderType? orderType,
  UriType? uriType,
  bool? requestPermission,
]) async {
  final List<dynamic> resultGenres =
      await _channel.invokeMethod("queryGenres", {
    "requestPermission": _checkPermission(requestPermission),
    "sortType":
        sortType != null ? sortType.index : GenreSortType.DEFAULT.index,
    "orderType": _checkOrder(orderType),
    "uri": uriType != null ? uriType.index : UriType.EXTERNAL.index
  });
  return resultGenres.map((genreInfo) => GenreModel(genreInfo)).toList();
}