getHaveOwnership method
getHaveOwnership() returns a Boolean representing the mobile device's ownership of a nearby M211.
This will only ever return True when communicating with an M211. It is possible to fail a connection to an M211, but successfully gain ownership, hence this method's existence.
Implementation
@override
Future<bool?> getHaveOwnership() async {
try {
bool? haveOwnership = await methodChannel.invokeMethod<bool>(
'getHaveOwnership',
);
return haveOwnership;
} on PlatformException catch (e) {
if (e.message?.contains('dataCorrupted') == true) {
return false;
}
rethrow;
}
}