checkConnectivity method
Check current connectivity status
Implementation
@override
Future<List<String>> checkConnectivity() async {
try {
final result = await methodChannel.invokeMethod<dynamic>('check');
if (result == null) {
return ['none'];
}
// Handle both List and single String
if (result is List) {
return result.map((e) => e.toString()).toList();
} else if (result is String) {
return [result];
} else {
return ['none'];
}
} on PlatformException catch (e) {
if (kDebugMode) {
print('Error checking connectivity: ${e.message}');
}
return ['none'];
} catch (e) {
if (kDebugMode) {
print('Unexpected error checking connectivity: $e');
}
return ['none'];
}
}