checkMotd method

Future<String> checkMotd()

Returns the message of the day

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'];
      // Check if same as last time
      if (prefs.getString('motd') == motd) {
        return '';
      }
      prefs.setString('motd', motd);
      return motd;
    }
  } catch (e) {
    // ignored
  }
  return '';
}