flutter-spm
Skill30 starsChanged 9 months agoMITView on GitHub
Use when migrating iOS and macOS Flutter plugin dependencies from CocoaPods to Swift Package Manager (SPM).
In this repository44 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- dart-add-unit-testSkill
- dart-build-cli-appSkill
- dart-collect-coverageSkill
- dart-fix-runtime-errorsSkill
- dart-generate-test-mocksSkill
- dart-genkitSkill
- dart-logic-patternsSkill
- dart-memorySkill
- dart-migrate-to-checks-packageSkill
- dart-modern-syntaxSkill
- dart-optimizationSkill
- dart-run-static-analysisSkill
- dart-toolingSkill
- dart-use-pattern-matchingSkill
- flutter-add-integration-testSkill
- flutter-add-widget-previewSkill
- flutter-add-widget-testSkill
- flutter-apply-architecture-best-practicesSkill
- flutter-bloc-formsSkill
- flutter-blocSkill
- flutter-build-responsive-layoutSkill
- flutter-code-genSkill
- flutter-configSkill
- flutter-debuggingSkill
- flutter-devtoolsSkill
- flutter-dioSkill
- flutter-firebaseSkill
- flutter-fix-layout-issuesSkill
- flutter-implement-json-serializationSkill
- flutter-isarSkill
- flutter-nativeSkill
- flutter-securitySkill
- flutter-setup-declarative-routingSkill
- flutter-setup-localizationSkill
- flutter-testingSkill
- flutter-uiSkill
- flutter-use-http-packageSkill
- flutter-wasm-webSkill
- changelog-writingSkill
- git-commitSkill
- github-actionsSkill
- github-prSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 85
If SPM dependencies fail to resolve during CLI builds:
- Distinctive: line 95
If multiple plugins request incompatible versions of the same Swift Package:
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Swift Package Manager (SPM) in Flutter
Introduced in Flutter 3.44
Swift Package Manager is the default dependency manager for iOS and macOS applications in Flutter, replacing CocoaPods. This modern integration improves compilation speeds and simplifies native package dependency trees.
Contents
- Project Configuration
- Managing Dependencies
- CI/CD Caching Strategies
- Troubleshooting & Conflict Resolution
Project Configuration
In Flutter 3.44+, newly generated iOS and macOS platforms are configured to use SPM out of the box.
Key Changes
- No
PodfileorPodfile.lock: The iOS directory no longer requires CocoaPods. - Xcode Workspace Integration: Native dependencies are managed directly via Xcode's Package Dependencies.
- Flutter Plugins: Plugins with native Swift code declare their SPM configurations inside their
pubspec.yamlorPackage.swiftfiles, which Flutter automatically integrates into the runner target.
Managing Dependencies
Adding a Swift Package
To add a native package directly to the iOS Runner:
- Open
ios/Runner.xcworkspacein Xcode. - Select File > Add Package Dependencies...
- Enter the package URL (e.g.,
https://github.com/Alamofire/Alamofire) and select target version. - Link the package to the
Runnertarget.
For Plugin Authors
To define an SPM dependency for a Flutter plugin, use the swift_packages field in pubspec.yaml:
flutter:
plugin:
platforms:
ios:
pluginClass: MyPlugin
swift_packages:
- name: Alamofire
url: https://github.com/Alamofire/Alamofire.git
version: 5.9.0CI/CD Caching Strategies
SPM dependencies are stored outside the project workspace. To optimize CI build times (e.g., in GitHub Actions), cache the following directories:
- SPM Cache Directory:
~/Library/Caches/org.swift.swiftpm - Xcode DerivedData:
~/Library/Developer/Xcode/DerivedData
GitHub Actions Caching Example
- name: Cache Swift Package Manager Dependencies
uses: actions/cache@v4
with:
path: |
~/Library/Caches/org.swift.swiftpm
~/Library/Developer/Xcode/DerivedData
key: ${{ runner.os }}-spm-${{ hashFiles('**/pubspec.yaml', 'ios/Runner.xcodeproj/project.pbxproj') }}
restore-keys: |
${{ runner.os }}-spm-Troubleshooting & Conflict Resolution
Package Resolution Failure
If SPM dependencies fail to resolve during CLI builds:
# 1. Clean the project
flutter clean
# 2. Resolve package dependencies manually via Xcode CLI
xcodebuild -resolvePackageDependencies -workspace ios/Runner.xcworkspace -scheme RunnerVersion Conflicts
If multiple plugins request incompatible versions of the same Swift Package:
- Open the project in Xcode.
- Navigate to Runner > Package Dependencies.
- Manually override the package dependency rule to enforce a unified, compatible version.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

