@@ -951,21 +951,40 @@ public void setDynamicFeatureManager(@NonNull DynamicFeatureManager dynamicFeatu
951951 this .dynamicFeatureManager = dynamicFeatureManager ;
952952 }
953953
954+ /**
955+ * Called by dart's deferred load handler to request that a dart deferred library corresponding
956+ * to loadingUnitId be downloaded (if necessary) and loaded into the dart vm.
957+ *
958+ * <p>This method delegates the task to DynamicFeatureManager, which handles the download and
959+ * loading of the dart library and any assets.
960+ *
961+ * @param loadingUnitId The loadingUnitId is assigned during compile time by gen_snapshot and is
962+ * automatically retrieved when loadLibrary() is called on a dart deferred
963+ * library.
964+ */
954965 @ SuppressWarnings ("unused" )
955966 @ UiThread
956967 public void RequestDartDeferredLibrary (int loadingUnitId ) {
957968 dynamicFeatureManager .downloadDynamicFeature (loadingUnitId , null );
958969 }
959970
960971 /**
961- * This should be called for every loading unit to be loaded into the dart isolate.
972+ * Searches each of the provided paths for a valid dart shared library .so file and resolves
973+ * symbols to load into the dart VM.
962974 *
963- * <p>abi, libName, and apkPaths are used together to search the installed apks for the desired
964- * .so library. If not found, soPath may be provided as a fallback if a pre-extracted .so exists,
965- * especially on older devices with libs compressed in the apk.
966- *
967- * <p>Successful loading of the dart library also completes the loadLibrary() future that
975+ * <p>Successful loading of the dart library completes the future returned by loadLibrary() that
968976 * triggered the install/load process.
977+ *
978+ * @param loadingUnitId The loadingUnitId is assigned during compile time by gen_snapshot and is
979+ * automatically retrieved when loadLibrary() is called on a dart deferred
980+ * library. This is used to identify which dart deferred library the resolved
981+ * correspond to.
982+ *
983+ * @param searchPaths An array of paths in which to look for valid dart shared libraries. This
984+ * supports paths within zipped apks as long as the apks are not compressed
985+ * using the `path/to/apk.apk!path/inside/apk/lib.so` format. Paths will be
986+ * tried first to last and ends when a library is sucessfully found. When the
987+ * found library is invalid, no additional paths will be attempted.
969988 */
970989 @ UiThread
971990 public void loadDartDeferredLibrary (
@@ -985,8 +1004,10 @@ private native void nativeLoadDartDeferredLibrary(
9851004 * Specifies a new AssetManager that has access to the dynamic feature's assets in addition to the
9861005 * base module's assets.
9871006 *
988- * <p>assetBundlePath is the subdirectory that the flutter assets are stored in. The typical value
989- * is `flutter_assets`.
1007+ * @param assetManager An android AssetManager that is able to access the newly downloaded assets.
1008+ *
1009+ * @param assetBundlePath The subdirectory that the flutter assets are stored in. The typical value
1010+ * is `flutter_assets`.
9901011 */
9911012 @ UiThread
9921013 public void updateAssetManager (
@@ -1001,19 +1022,33 @@ private native void nativeUpdateAssetManager(
10011022 @ NonNull AssetManager assetManager ,
10021023 @ NonNull String assetBundlePath );
10031024
1004- // Called when an install encounters a failure during the Android portion of installing a module.
1005- // When transient is false, new attempts to install will automatically result in same error in
1006- // dart before the request is passed to Android.
1025+ /**
1026+ * Indicates that a failure was encountered during the Android portion of downloading and installing
1027+ * a dynamic feature module.
1028+ *
1029+ * <p>This will inform dart that the future returned by loadLibrary() should complete with an error.
1030+ *
1031+ * @param loadingUnitId The loadingUnitId that corresponds to the dart deferred library that
1032+ * failed to install.
1033+ *
1034+ * @param moduleName The name of the module that includes the loadingUnitId. This parameter is
1035+ * not necessary and used for logging purposes.
1036+ *
1037+ * @param error The error message to display.
1038+ *
1039+ * @param isTransient When isTransient is false, new attempts to install will automatically result in
1040+ * same error in dart before the request is passed to Android.
1041+ */
10071042 @ SuppressWarnings ("unused" )
10081043 @ UiThread
10091044 public void dynamicFeatureInstallFailure (
1010- @ NonNull String moduleName , int loadingUnitId , @ NonNull String error , boolean isTransient ) {
1045+ int loadingUnitId , String moduleName , @ NonNull String error , boolean isTransient ) {
10111046 ensureRunningOnMainThread ();
1012- nativeDynamicFeatureInstallFailure (moduleName , loadingUnitId , error , isTransient );
1047+ nativeDynamicFeatureInstallFailure (loadingUnitId , moduleName , error , isTransient );
10131048 }
10141049
10151050 private native void nativeDynamicFeatureInstallFailure (
1016- @ NonNull String moduleName , int loadingUnitId , @ NonNull String error , boolean isTransient );
1051+ int loadingUnitId , String moduleName , @ NonNull String error , boolean isTransient );
10171052
10181053 // ----- End Dynamic Features Support ----
10191054
0 commit comments