BTException.fromPlatform constructor
BTException.fromPlatform(
- PlatformException exception
Implementation
factory BTException.fromPlatform(PlatformException exception) {
BTError error;
if (exception.code == BTError.bluetoothNotAvailable.index.toString()) {
error = BTError.bluetoothNotAvailable;
} else if (exception.code == BTError.permissionNotGranted.index.toString()) {
error = BTError.permissionNotGranted;
} else if (exception.code == BTError.errorWithMessage.index.toString()) {
error = BTError.errorWithMessage;
} else {
error = BTError.unknown;
}
return BTException(error, message: exception.message);
}