Prerequisites
- A working Flutter quickstart
- Cloud Filters enabled for the project
Request the catalog
final filters = await NosmaiFlutter.instance.getCloudFilters( filterType: NosmaiCloudFilterType.effects, page: 1, limit: 20, );
Other typed values include filter, background, beautyEffect, and games.
Download and apply
final filter = filters.first;
final result = await NosmaiFlutter.instance.downloadCloudFilter(
filter.cloudIdentifier,
);
final path = result['path'] as String?;
if (path == null || path.isEmpty) {
throw StateError('Cloud Filter download returned no path');
}
await NosmaiFlutter.instance.applyEffect(path);
Remove a cached item only after an explicit user or product action:
await NosmaiFlutter.instance.removeCloudFilter( filter.cloudIdentifier, );
Handle cache eviction
Do not persist path as a permanent asset path. The cache has no documented cross-platform TTL and the operating system can reclaim it. Query the SDK's downloaded state when the item is selected; if it is missing, call downloadCloudFilter again and use the new returned path.
Verify it worked
Close and reopen the filter UI, then apply the cached item with network disabled.
Common errors
| Symptom | Fix |
|---|---|
| Catalog is empty | Check cloud capability, type, and native key configuration |
| Returned path is null | Treat the download as failed and show Retry |
| Two downloads start | Store one Future per cloudIdentifier |