getBaseUrl function Null safety

Future<BaseUrl?> getBaseUrl(
  1. String chapterId
)

Implementation

Future<BaseUrl?> getBaseUrl(
  String chapterId,
) async {
  var response = await getBaseUrlResponse(chapterId);
  var headers = response.headers;
  if (headers['x-ratelimit-remaining'] == '0') {
    print('Rate Limit Exceeded.');
  } else {
    if (chapterId == '') {
      print('Chapter ID is an empty String!');
    } else {
      return BaseUrl.fromJson(jsonDecode(response.body));
    }
  }
}