model method

  1. @override
Future<DeviceModel> model()
override

Implementation

@override
Future<DeviceModel> model() async {
  String? model = await _channel.invokeMethod('model');

  if (model == null) {
    throw Exception('Failed to get device model');
  }

  if (int.tryParse(model) != null) {
    return DeviceModel.unknown.fromId(int.parse(model));
  }

  return DeviceModel.unknown.fromString(model);
}