checkMotd method Null safety

Future<String> checkMotd()

Returns the message of the day @return Future

Implementation

Future<String> checkMotd() async {
  try {
    var response = await Dio().get(motdUrl);
    if (response.data.length > 0) {
      var jsonData = json.decode(response.data);
      String motd = jsonData['motd'];
      return motd;
    }
  } catch (e) {
    // ignored
  }
  return '';
}