check null safety
This commit is contained in:
@@ -11,7 +11,7 @@ class NetworkConnectivity {
|
||||
final log = Logger('NetworkConnectivity');
|
||||
|
||||
static final NetworkConnectivity instance = NetworkConnectivity._internal();
|
||||
static String hostName;
|
||||
static String? hostName;
|
||||
NetworkConnectivity._internal() {
|
||||
_initialise();
|
||||
var uri = Uri.parse(Config.instance.apiURL);
|
||||
@@ -38,7 +38,7 @@ class NetworkConnectivity {
|
||||
// lookup if connectivity is not none
|
||||
if (result != ConnectivityResult.none) {
|
||||
try {
|
||||
final hostNameLookup = await InternetAddress.lookup(hostName);
|
||||
final hostNameLookup = await InternetAddress.lookup(hostName ?? "");
|
||||
if (hostNameLookup.isNotEmpty &&
|
||||
hostNameLookup[0].rawAddress.isNotEmpty) {
|
||||
if (await checkHeartbeat()) {
|
||||
|
||||
Reference in New Issue
Block a user