Flutter Engine
The Flutter Engine
Static Public Member Functions | Static Public Attributes | List of all members
io.flutter.plugins.GeneratedPluginRegistrant Class Reference

Static Public Member Functions

static void registerWith (@NonNull FlutterEngine engine)
 
static void clearRegisteredEngines ()
 
static List< FlutterEnginegetRegisteredEngines ()
 

Static Public Attributes

static RuntimeException pluginRegistrationException
 

Detailed Description

A fake of the GeneratedPluginRegistrant normally built by the tool into Flutter apps.

Used to test engine logic which interacts with the generated class.

Definition at line 16 of file GeneratedPluginRegistrant.java.

Member Function Documentation

◆ clearRegisteredEngines()

static void io.flutter.plugins.GeneratedPluginRegistrant.clearRegisteredEngines ( )
inlinestatic

Clears the mutable static state regrettably stored in this class.

registerWith is a static call with no visible side effects. In order to verify when it's been called we also unfortunately need to store the state statically. This should be called before and after each test run accessing this class to make sure the state is clear both before and after the run.

Definition at line 41 of file GeneratedPluginRegistrant.java.

41 {
42 registeredEngines.clear();
43 }

◆ getRegisteredEngines()

static List< FlutterEngine > io.flutter.plugins.GeneratedPluginRegistrant.getRegisteredEngines ( )
inlinestatic

Returns a list of all the engines registered so far.

CAUTION: This list is static and must be manually wiped in between test runs. See clearRegisteredEngines().

Definition at line 52 of file GeneratedPluginRegistrant.java.

52 {
53 return new ArrayList<>(registeredEngines);
54 }

◆ registerWith()

static void io.flutter.plugins.GeneratedPluginRegistrant.registerWith ( @NonNull FlutterEngine  engine)
inlinestatic

The one and only method currently generated by the tool.

Normally it registers all plugins in an app with the given engine. This fake tracks all registered engines instead.

Definition at line 26 of file GeneratedPluginRegistrant.java.

26 {
27 if (pluginRegistrationException != null) {
29 }
30 registeredEngines.add(engine);
31 }
FlutterEngine engine
Definition: main.cc:68

Member Data Documentation

◆ pluginRegistrationException

RuntimeException io.flutter.plugins.GeneratedPluginRegistrant.pluginRegistrationException
static

Definition at line 18 of file GeneratedPluginRegistrant.java.


The documentation for this class was generated from the following file: