• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 package io.flutter.embedding.engine.plugins;
6 
7 import android.support.annotation.NonNull;
8 import android.support.annotation.Nullable;
9 
10 import java.util.Set;
11 
12 public interface PluginRegistry {
13 
14   /**
15    * Attaches the given {@code plugin} to the {@link io.flutter.embedding.engine.FlutterEngine}
16    * associated with this {@code PluginRegistry}.
17    */
add(@onNull FlutterPlugin plugin)18   void add(@NonNull FlutterPlugin plugin);
19 
20   /**
21    * Attaches the given {@code plugins} to the {@link io.flutter.embedding.engine.FlutterEngine}
22    * associated with this {@code PluginRegistry}.
23    */
add(@onNull Set<FlutterPlugin> plugins)24   void add(@NonNull Set<FlutterPlugin> plugins);
25 
26   /**
27    * Returns true if a plugin of the given type is currently attached to the
28    * {@link io.flutter.embedding.engine.FlutterEngine} associated with this {@code PluginRegistry}.
29    */
has(@onNull Class<? extends FlutterPlugin> pluginClass)30   boolean has(@NonNull Class<? extends FlutterPlugin> pluginClass);
31 
32   /**
33    * Returns the instance of a plugin that is currently attached to the
34    * {@link io.flutter.embedding.engine.FlutterEngine} associated with this {@code PluginRegistry},
35    * which matches the given {@code pluginClass}.
36    * <p>
37    * If no matching plugin is found, {@code null} is returned.
38    */
39   @Nullable
get(@onNull Class<? extends FlutterPlugin> pluginClass)40   FlutterPlugin get(@NonNull Class<? extends FlutterPlugin> pluginClass);
41 
42   /**
43    * Detaches the plugin of the given type from the {@link io.flutter.embedding.engine.FlutterEngine}
44    * associated with this {@code PluginRegistry}.
45    * <p>
46    * If no such plugin exists, this method does nothing.
47    */
remove(@onNull Class<? extends FlutterPlugin> pluginClass)48   void remove(@NonNull Class<? extends FlutterPlugin> pluginClass);
49 
50   /**
51    * Detaches the plugins of the given types from the {@link io.flutter.embedding.engine.FlutterEngine}
52    * associated with this {@code PluginRegistry}.
53    * <p>
54    * If no such plugins exist, this method does nothing.
55    */
remove(@onNull Set<Class<? extends FlutterPlugin>> plugins)56   void remove(@NonNull Set<Class<? extends FlutterPlugin>> plugins);
57 
58   /**
59    * Detaches all plugins that are currently attached to the
60    * {@link io.flutter.embedding.engine.FlutterEngine} associated with this {@code PluginRegistry}.
61    * <p>
62    * If no plugins are currently attached, this method does nothing.
63    */
removeAll()64   void removeAll();
65 }
66