makeBackup method

Future<String?> makeBackup(
  1. String packageName
)

This method creates "backups" folder if not exists under your app files folder and saves a backup apk of the specified app.

Note that all backups gets stored in your app file directory
under a sub directory called ""backups"
for example if your app package name is com.example.name then backups will be
stored under /storage/emulated/0/Android/data/com.example.name/files/backups .

Implementation

Future<String?> makeBackup(String packageName) async {
  assert(packageName.isNotEmpty, "packageName can not be empty!");
  try {
    String? backupResult = await _channel.invokeMethod(
      "makeBackup",
      {"packageName": packageName},
    );
    return backupResult;
  } on PlatformException catch (e) {
    throwError(e, "making a backup for $packageName");
    return "UnexpectedError";
  }
}