Repository navigation
overview getting started
Use Flutter to install the package, then configure iCloud capabilities in the consuming Apple app. Dart tests can run without iCloud; native runtime behavior needs a configured Apple environment (README.md, AGENTS.md).
pubspec.yaml declares Dart >=3.0.0 <4.0.0 and Flutter >=3.10.0. Native deployment floors are iOS 13.0 and macOS 10.15. The example requires Dart >=3.1.0 <4.0.0 (example/pubspec.yaml).
Use Xcode and signing appropriate for the app's iCloud container. No root dependency lockfile is checked in, so declared lower bounds do not describe one reproducible resolved development toolchain.
From the consuming Flutter app:
flutter pub add icloud_storage_plusCreate an iCloud container for the App ID. In the app target's Xcode Signing & Capabilities settings, enable iCloud Documents and select that container. For Files app visibility, configure NSUbiquitousContainers in the app's Info.plist and store visible items below the literal Documents/ prefix (README.md).
Swift Package Manager integration is optional and documented for Flutter 3.24 or later:
flutter config --enable-swift-package-managerThe plugin also ships CocoaPods specifications. See Configuration for the packaging and entitlement entry points.
import 'package:icloud_storage_plus/icloud_storage.dart';
Future<String?> readExample() async {
if (!await ICloudStorage.icloudAvailable()) return null;
const containerId = 'iCloud.com.yourapp.container';
const path = 'Documents/example.txt';
await ICloudStorage.writeInPlace(
containerId: containerId,
relativePath: path,
contents: 'Hello from the local container',
);
return ICloudStorage.readInPlace(
containerId: containerId,
relativePath: path,
);
}The API in lib/icloud_storage.dart returns non-nullable contents on successful reads. Missing items throw an operation exception; the example's nullable result only represents the availability check. Use path-only transfers for large files because in-place operations pass complete contents through Flutter channels.
From the repository root:
flutter pub get
flutter analyze
flutter testFor native helper changes, run targeted tests from the supported Foundation package on a Mac:
swift test --package-path ios/icloud_storage_plus/Sources/icloud_storage_plus_foundation
swift test --package-path macos/icloud_storage_plus/Sources/icloud_storage_plus_foundationThese packages use Apple Foundation APIs. A Linux Swift installation is not sufficient to verify Darwin document behavior. Do not substitute a top-level swift build for Flutter integration.
From example/, fetch packages and run on a supported target:
flutter pub get
flutter run -d macosFor iOS, select a configured device with flutter devices and run flutter run -d <device-id>. Configure signing, entitlements, and the container entered in the demo before expecting file access. example/lib/main.dart exposes gather, listing, upload/download, delete, move, and rename screens; it is not an automated integration suite.
Prefer a physical device for iCloud behavior. Capture Flutter debug and platform logs when verifying native changes (AGENTS.md). Continue with Testing or Debugging.