Skip to main content

Create and Export Backup

Minimal Flutter flow to create a backup and export it.

Example

import 'package:blockchain_kit_sdk_flutter_plugin/blockchain_kit_sdk_flutter_plugin.dart';

final sdk = BlockchainKitSdk();
const groupId = 'YOUR_GROUP_ID';

final wrappers = <FlutterWrapperConfig>[
// Add passkey/pin/password wrappers as needed for your policy.
WrapperConfigFactories.guardianGatedEscrowNoGate(),
];

final locations = <StorageLocation>[
StorageLocation.CLOUD,
StorageLocation.EXPORT,
];

final backupResult = await sdk.backupService.createBackup(groupId, wrappers, locations);

await backupResult.fold(
(backup) async {
print('Backup created: bundle=${backup.bundleId}, wrappers=${backup.wrapperCount}');

final exportResult = await sdk.backupService.exportToDownloads(groupId);
exportResult.fold(
(path) => print('Backup exported to: $path'),
(error) => print('Export failed: ${error.message}'),
);
},
(error) async {
print('Backup failed: ${error.message}');
},
);

Notes

  • Backups are sensitive artifacts. Treat exported files as secrets.
  • Use explicit storage and access-control policy before production rollout.