init method

  1. @override
Future<MapxusMethodResponse> init(
  1. String appId,
  2. String secret
)
override

Initializes the Mapxus Positioning SDK with the given appId and secret.

Returns a MapxusMethodResponse indicating whether initialization succeeded.

Implementation

@override
Future<MapxusMethodResponse> init(String appId, String secret) async {
  try {
    final result =
    await _channel.invokeMethod<Map<dynamic, dynamic>>('init', {
      'appId': appId,
      'secret': secret,
    });
    return MapxusMethodResponse.fromMap({
      "success": result?['success'] ?? false,
      "message": result?['message'] ?? 'Unknown error'
    });
  } catch (e) {
    return MapxusMethodResponse.fromMap({
      "success": false,
      "message": e.toString(),
    });
  }
}