followManga function Null safety

Future<MangaCheck> followManga(
  1. String token,
  2. String mangaId,
  3. {ReadingStatus? status}
)

Implementation

Future<MangaCheck> followManga(String token, String mangaId,
    {ReadingStatus? status}) async {
  var unencodedPath = '/manga/$mangaId/follow';
  final uri = 'https://$authority$unencodedPath';
  var response = await http.post(Uri.parse(uri), headers: {
    HttpHeaders.contentTypeHeader: 'application/json',
    HttpHeaders.authorizationHeader: 'Bearer $token'
  });

  try {
    //set manga reading status by default
    await setMangaReadingStatus(
        token, mangaId, status ?? ReadingStatus.reading);
    print(
        'set reading status as \'${status != null ? status.toString() : 'reading'}\' for manga $mangaId');
  } catch (e) {
    print("couldn't set reading status for manga $mangaId");
  }
  return MangaCheck.fromJson(jsonDecode(response.body));
}