setContentView

layout

my_activity_layout

// Get a reference to the Activity's FragmentManager to add a new

// FlutterFragment, or find an existing one.

val

fragmentManager

FragmentManager

supportFragmentManager

// Attempt to find an existing FlutterFragment, in case this is not the

// first time that onCreate() was run.

flutterFragment

fragmentManager

findFragmentByTag

TAG_FLUTTER_FRAGMENT

as

FlutterFragment

// Create and attach a FlutterFragment if one does not exist.

if

flutterFragment

==

null

var

newFlutterFragment

FlutterFragment

createDefault