Skip to content

A flutter library that provides the play asset delivery API

License

Notifications You must be signed in to change notification settings

chasing/flutter_play_asset

 
 

Repository files navigation

flutter_play_asset

This library provides the play asset delivery functionality from the play core library for Flutter framework. Only works for Android.

Installation & Testing

Setup Android Environtment settings

dependencies:
  flutter_play_asset: ^1.0.0

How it works

Initialize the listener

You need to initialize an object FlutterPlayAsset inside the class where the download take action. You can handle the download process by overriding the callback method that will be called by the download process

class ViewPlayAsset {
  void OnProgressDownload(int percentage){

  }

  void OnAssetPathFound(String path){

  }

  void OnProcessLoadingAssetPath(String path){

  }
}

The class that requesting the download need to implement ViewPlayAsset to be able to override the callbacks. So you need to initialize your FlutterPlayAsset in the initState

FlutterPlayAsset.init(this);

Check location of the downloaded asset pack

You can use the assets inside on-demand asset pack by load them from the internal storage. So you need the absolute path where the asset pack is saved, then append them with the asset name. FlutterPlayAsset a method returning this path with this function.

flutterPlayAsset.getAssetPath(assetPackName);

Testing the app

You can test the app locally by downloading the bundletool and following this guideline https://developer.android.com/guide/app-bundle/asset-delivery#next-step-instructions

About

A flutter library that provides the play asset delivery API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Kotlin 40.2%
  • Dart 33.3%
  • Ruby 11.7%
  • HTML 6.1%
  • Swift 4.8%
  • Objective-C 3.9%