setDashboardURL method

Future<void> setDashboardURL(
  1. String? url
)

Sets the API's base URL to retrieve the data. Make sure you follow the next steps:

Failing to follow this order might result in unexpected behavior.

Failing to implement this parameter might result in unexpected behavior.

url should include only the protocol and the domain (e.g., "https://dashboard.situm.com"). Do not include paths or query parameters.

Implementation

Future<void> setDashboardURL(String? url) async {
  if (url == null) {
    url = "https://dashboard.situm.com";
  } else {
    if (!url.startsWith(RegExp(r'https://'))) {
      url = "https://$url";
    }
    if (url.endsWith('/')) {
      url = url.substring(0, url.length - 1);
    }
  }

  await methodChannel.invokeMethod(
    "setDashboardURL",
    <String, dynamic>{
      'url': url,
    },
  );
}