getProject method Null safety

Future<MBProject> getProject(
  1. {bool includeContracts = false}

Retrieve the MBurger project.

  • Parameters:
    • includeContracts: if this is true the contracts are included in the project object.
  • Returns a Future that completes with the MBProject retrieved.


Future<MBProject> getProject({bool includeContracts = false}) async {
  Map<String, String> apiParameters = {};

  if (includeContracts) {
    apiParameters['include'] = 'contracts';

  String apiName = 'api/project';

  apiParameters.addAll(await defaultParameters());

  var uri = Uri.https(endpoint, apiName, apiParameters);
  var response = await http.get(uri, headers: await headers());
  Map<String, dynamic> body = MBManager.checkResponse(response.body);
  return MBProject.fromDictionary(body);