Implement Play Asset Delivery In flutter


How to implement on-demand Play Asset Delivery in flutter through methodchannels.

Actually i am trying to make a dashboard for some app which accesses assets using ContentProvider so i thought play asset delivery might work here.
I know that same can be achieved using deferred components and I have already tried deferred components which is provided by flutter.
You can find it here

Currently, there is an issue with flutter which causes assets to not load when deferred. You can find a link to the issue here.

I do not have any idea of native language and this is the only option I have right now which is implementing a methodchannel so any help would be appreciated


I dont think you can achieve the same thing using play asset delivery. You can try a workaround for this
Disable android:enabled by default by adding android:enabled="false" in your content provider and then use below methodchannel to enable it later

package dev.blah.blah;

import androidx.annotation.NonNull;
import io.flutter.embedding.engine.FlutterEngine;
import io.flutter.plugin.common.MethodChannel;
import android.content.ContextWrapper;
import android.widget.Toast;

public class MainActivity extends FlutterActivity {
  private static final String CHANNEL = "dev.dhanraj.kwgt.test.dashboard";

  public void configureFlutterEngine(@NonNull FlutterEngine flutterEngine) {
    new MethodChannel(flutterEngine.getDartExecutor().getBinaryMessenger(), CHANNEL)
          (call, result) -> {
            // Note: this method is invoked on the main thread.
            if (call.method.equals("enable")) {
              ContextWrapper aContext = new ContextWrapper(getApplicationContext());
              aContext.getPackageManager().setComponentEnabledSetting(new android.content.ComponentName(aContext, "org.kustom.api.Provider"),, 1);
              Toast.makeText(this, "Done", Toast.LENGTH_SHORT).show();
            } else{

Answered By – Dhanraj Priyadarshi

Answer Checked By – Mary Flores (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *