NavigineSDK.initializeSDK constructor

NavigineSDK.initializeSDK({
  1. required String userHash,
  2. String serverURL = "https://api.navigine.com",
})

Implementation

NavigineSDK.initializeSDK({
  required String userHash,
  String serverURL = "https://api.navigine.com",
}) {
  _channel.invokeMethod('initialize', {
    "userHash": userHash,
    "serverUrl": serverURL,
  });
  _channel.setMethodCallHandler((call) async {
    switch (call.method) {
      case "location#onFailed":
        _locationCompleter?.completeError(
          Exception(
            "Unable to download the location. Error code: ${call.arguments}",
          ),
        );
        break;
      case "location#onFinished":
        _locationCompleter?.complete();
        break;
      case "deviceInfo#onUpdate":
      case "marketing#onNotification":
        location?._handleMethodCall(call);
        break;
    }
    return true;
  });
}