addSupervisor method

Future<int> addSupervisor(
  1. String name
)

Implementation

Future<int> addSupervisor(String name) async {
  final List<dynamic> supervisors = await this.supervisors();
  for (final Map<String, dynamic> element in supervisors) {
    if (element["fullName"] == name) {
      return element["id"];
    }
  }
  final Either<String, Map<String, dynamic>> res = await mappingPostRequest(
    "/supervisors",
    <String, dynamic>{"fullName": name},
  ).run();

  return res.getOrElse((String l) => <String, dynamic>{})["id"];
}