Mobile development: Dismissing the Flutter module in Android apps

Wondering how to quickly dismiss the Flutter module in you Android mobile app? This short tutorial is for you!

In my previous post, I was showing you how to dismiss FlutterViewController in iOS apps.

This time, I’d like to focus on the Android side of things. So let’s check, how to dismiss the Flutter module (added as AAR) from an Android app.

It is way easier than in Xcode, to be honest.

Flutter as an Android package module

Flutter can be used not only as a standalone app but also as a framework - injected portion of code that works on two main mobile platforms (Android, iOS).

In iOS, you can build a CocoaPods module or an iOS framework. On Android, you create an AAR module that can be simply imported inside an app written in Kotlin or Java.

How to close Flutter from an Android app

In iOS apps, we needed to call the MethodChannel functionality to close the Flutter module.

With Android, the whole process is much easier. We just need to call FlutterEngine - exactly as shown by Google in its tutorial. Of course, if you want to monitor this functionality, you can always use MethodChannel.

In Flutter, it is done with a method called inside the dismissed function.

Something like this:

await channel.invokeMethod('dismissView');

In Android, you do it like this:

channel.setMethodCallHandler { call, result ->
    if (call.method.equals("dismissView")) {
        println("Flutter View  has been dismissed");

However, the core of closing the Flutter module is a method called inside Flutter:


This will immediately close the Flutter app (in this case, the module used inside an Android app).

If you use the `MethodChannel, you can get back information on the action that has just been performed (e.g. whether a function is working).

Worth knowing - this function doesn’t work with iOS. In that case, you should close FlutterViewController from the native app.

That’s all for now, folks.

Looking for mobile development experts? Drop us a line.

Start a project with your dedicated software house


Contact us

* Required fields

Elo Mordo!Elo Mordo!