MethodChannelDeeplinksFlutter constructor

MethodChannelDeeplinksFlutter()

Implementation

MethodChannelDeeplinksFlutter() {
  if (_initialized) {
    return;
  }

  methodChannel.setMethodCallHandler((call) async {
    switch (call.method) {
      case "NiceDeepLinks#onLinkSuccess":
        final data = call.arguments as String?;

        if (data != null) {
          _onLinkController.add(data);
        }
        break;
      case "NiceDeepLinks#onLinkError":
        break;
      default:
        throw UnimplementedError("${call.method} has not been implemented");
    }
  });

  _initialized = true;
}