cloud_helper 1.0.0 cloud_helper: ^1.0.0 copied to clipboard
A Flutter project for working with iCloud.
cloud_helper #
Plugin for Flutter that allows uploading, deleting and modifying records to iCloud.
Prerequisite #
The following setups are needed in order to use this plugin:
- An apple developer account
- Created an App ID and iCloud Container ID
- Enabled iCloud capability and assigned iCloud Container ID for the App ID
- Enabled iCloud capability in Xcode
Refer to the How to set up iCloud Container and enable the capability section for more detailed instructions.
API Usage #
Get instance #
final cloudHelper = await CloudHelper.create('iCloudContainerId');
Get files from iCloud #
final fileList = await cloudHelper.getAllRecords(type: 'recordType');
Upload a file to iCloud #
await cloudHelper.addRecord(
data: 'recordData',
id: 'recordId',
type: 'recordType',
);
Delete a file from iCloud #
await cloudHelper.deleteRecord(id: recordId,);
Modify a file #
await cloudHelper.editRecord(
id: 'recordId',
data: 'newData',
);
How to set up iCloud Container and enable the capability #
- Log in to your apple developer account and select 'Certificates, IDs & Profiles' from the left navigation.
- Select 'Identifiers' from the 'Certificates, IDs & Profiles' page, create an App ID if you haven't done so, and create an iCloud Containers ID.
- Click on your App ID. In the Capabilities section, select 'iCloud' and assign the iCloud Container created in step 2 to this App ID.
- Open your project in Xcode. Set your App ID as 'Bundle Identifier' if you haven't done so. Click on '+ Capability' button, select iCloud, then tick 'CloudKit' in the Services section and select your iCloud container.