getAllMedia method Null safety

Future<List<MBMedia>> getAllMedia()

Retrieve all the media of the project.

  • Returns a Future that completes with the all the MBMedia saved in the media center of the project.


Future<List<MBMedia>> getAllMedia() async {
  Map<String, String> apiParameters = {};
  String apiName = 'api/media';

  apiParameters.addAll(await defaultParameters());

  var uri = Uri.https(endpoint, apiName, apiParameters);
  var response = await http.get(uri, headers: await headers());
  List<dynamic>? body =
  List<Map<String, dynamic>> bodyArray =
      List.castFrom<dynamic, Map<String, dynamic>>(body);
  return => MBMedia(dictionary: d)).toList();