getInstance static method
Retreive an singleton instance of DeviceInfo
.
Implementation
static Future<DeviceInfo> getInstance() async {
Completer completer = new Completer<DeviceInfo>();
if (_instance == null) {
Map map = (await _methodChannel.invokeMapMethod('getDeviceInfo'))!;
_instance = new DeviceInfo(
model: map['model'],
manufacturer: map['manufacturer'],
version: map['version'],
platform: map['platform'],
framework: map['framework']);
}
completer.complete(_instance);
return completer.future as FutureOr<DeviceInfo>;
}