* feat(android, dart): add check for initialization, show proper error messages * feat(exception): add exception mapper for android and ios * feat(ios): check initialization in swift * fix(android): add initialization check for methods, remove disconnect() inside onDetachedFromEngine * chore: code style, version, changelog
22 lines
670 B
Dart
22 lines
670 B
Dart
import 'dart:io';
|
|
|
|
import 'package:nearby_service/nearby_service.dart';
|
|
import 'package:nearby_service/src/platforms/android/utils/mapper.dart';
|
|
import 'package:nearby_service/src/platforms/ios/utils/mapper.dart';
|
|
|
|
abstract class NearbyServiceExceptionMapper {
|
|
static NearbyServiceExceptionMapper get instance {
|
|
if (Platform.isAndroid) {
|
|
return NearbyServiceAndroidExceptionMapper();
|
|
} else if (Platform.isIOS) {
|
|
return NearbyServiceIOSExceptionMapper();
|
|
}
|
|
throw NearbyServiceException.unsupportedPlatform(
|
|
caller: 'NearbyServiceExceptionMapper',
|
|
);
|
|
}
|
|
|
|
bool canMap(String error);
|
|
|
|
NearbyServiceException map(String error);
|
|
} |