new

FlutterLoader

mockFlutterJNI

))

build

());

This should be very uncommon.

Context

The FlutterMain class itself is being deprecated and replaced with the
FlutterInjector class. The FlutterMain class uses a number of
static variables and functions than make it difficult to test.
FlutterMain.setIsRunningInRobolectricTest() is one ad-hoc static
mechanism to allow tests to run on the host machine on JVM without
loading the libflutter.so native library
(which can’t be done on the host machine).

Rather than one-off solutions, all dependency injections needed for tests
in Flutter’s Android/Java engine embedding are now moved to the
FlutterInjector class.