getSystemMetrics method
Implementation
@override
Future<SystemMetrics> getSystemMetrics() async {
try {
final Map<dynamic, dynamic>? res = await methodChannel.invokeMethod('getSystemMetrics');
if (res == null) return SystemMetrics(timestamp: DateTime.now());
return SystemMetrics.fromMap(res.cast<String, dynamic>());
} on PlatformException catch (e) {
throw DeviceInspectorException(_mapErrorCode(e.code), e.message ?? 'Failed to get system metrics', cause: e);
} catch (e) {
return SystemMetrics(timestamp: DateTime.now());
}
}