/// <summary> /// Adds a dotnet plugin. /// </summary> public void AddPlugin(IFlutterPlugin plugin) { if (plugin == null) { throw new ArgumentNullException(nameof(plugin)); } if (_plugins.TryAdd(plugin.GetHashCode(), plugin)) { plugin.OnAttachedToEngine(new FlutterPluginBindingImpl()); } }
/// <summary> /// Removes an added dotnet plugin. /// </summary> public void RemovePlugin(IFlutterPlugin plugin) { if (plugin == null) { throw new ArgumentNullException(nameof(plugin)); } if (_plugins.TryRemove(plugin.GetHashCode(), out IFlutterPlugin removedPlugin)) { removedPlugin.OnDetachedFromEngine(); } }
/// <summary> /// Returns whether the plugin is registered. /// </summary> public bool HasPlugin(IFlutterPlugin plugin) { return(plugin != null && _plugins.ContainsKey(plugin.GetHashCode())); }