522 lines
13 KiB
Markdown
522 lines
13 KiB
Markdown
|
|
# Riverpod 3.0 Migration - Complete Guide
|
||
|
|
|
||
|
|
**Comprehensive index for the Conduit Riverpod 3.0 migration**
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 📚 Documentation Overview
|
||
|
|
|
||
|
|
This repository contains a complete migration plan for upgrading the Conduit codebase to use Riverpod 3.0 best practices with code generation.
|
||
|
|
|
||
|
|
### Document Structure
|
||
|
|
|
||
|
|
```
|
||
|
|
Migration Documentation
|
||
|
|
├── Analysis & Planning
|
||
|
|
│ ├── RIVERPOD_3_ANALYSIS.md .................. Initial codebase analysis
|
||
|
|
│ ├── RIVERPOD_SUMMARY.md ..................... Executive summary
|
||
|
|
│ └── RIVERPOD_QUICKSTART.md .................. Quick start guide
|
||
|
|
│
|
||
|
|
├── Implementation
|
||
|
|
│ ├── Priority 1 (COMPLETED ✅)
|
||
|
|
│ │ └── RIVERPOD_PRIORITY1_COMPLETED.md ..... Linting setup (done)
|
||
|
|
│ │
|
||
|
|
│ └── Priority 2 (PLANNED 📋)
|
||
|
|
│ ├── RIVERPOD_PRIORITY2_PLAN.md .......... Detailed migration plan
|
||
|
|
│ ├── RIVERPOD_PRIORITY2_QUICKREF.md ...... Quick reference guide
|
||
|
|
│ └── RIVERPOD_PRIORITY2_TRACKER.md ....... Progress tracker
|
||
|
|
│
|
||
|
|
└── Examples & Reference
|
||
|
|
└── docs/riverpod_migration_example.md ...... Step-by-step examples
|
||
|
|
```
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 🎯 Quick Start
|
||
|
|
|
||
|
|
### For New Developers
|
||
|
|
|
||
|
|
1. Read **RIVERPOD_SUMMARY.md** for overview
|
||
|
|
2. Review **RIVERPOD_QUICKSTART.md** for patterns
|
||
|
|
3. Check **docs/riverpod_migration_example.md** for examples
|
||
|
|
|
||
|
|
### For Migration Contributors
|
||
|
|
|
||
|
|
1. Start with **RIVERPOD_PRIORITY2_PLAN.md** for full context
|
||
|
|
2. Use **RIVERPOD_PRIORITY2_QUICKREF.md** as daily reference
|
||
|
|
3. Track progress in **RIVERPOD_PRIORITY2_TRACKER.md**
|
||
|
|
|
||
|
|
### For Project Leads
|
||
|
|
|
||
|
|
1. Review **RIVERPOD_3_ANALYSIS.md** for technical assessment
|
||
|
|
2. Check **RIVERPOD_PRIORITY1_COMPLETED.md** for completed work
|
||
|
|
3. Evaluate **RIVERPOD_PRIORITY2_PLAN.md** for timeline and resources
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 📖 Document Descriptions
|
||
|
|
|
||
|
|
### Analysis Documents
|
||
|
|
|
||
|
|
#### [RIVERPOD_3_ANALYSIS.md](./RIVERPOD_3_ANALYSIS.md)
|
||
|
|
**Purpose:** Initial technical analysis of Riverpod 3.0 alignment
|
||
|
|
**Audience:** Technical leads, architects
|
||
|
|
**Key Content:**
|
||
|
|
- Current state assessment
|
||
|
|
- Detailed recommendations
|
||
|
|
- Migration phases overview
|
||
|
|
- Testing strategy
|
||
|
|
- Performance considerations
|
||
|
|
|
||
|
|
**When to Read:** Before starting any migration work
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
#### [RIVERPOD_SUMMARY.md](./RIVERPOD_SUMMARY.md)
|
||
|
|
**Purpose:** High-level executive summary
|
||
|
|
**Audience:** All team members, stakeholders
|
||
|
|
**Key Content:**
|
||
|
|
- Quick overview of migration
|
||
|
|
- Key benefits
|
||
|
|
- High-level timeline
|
||
|
|
- Risk assessment
|
||
|
|
|
||
|
|
**When to Read:** For a quick understanding of the migration
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
#### [RIVERPOD_QUICKSTART.md](./RIVERPOD_QUICKSTART.md)
|
||
|
|
**Purpose:** Quick reference for Riverpod 3.0 patterns
|
||
|
|
**Audience:** All developers
|
||
|
|
**Key Content:**
|
||
|
|
- Common patterns
|
||
|
|
- Code examples
|
||
|
|
- Best practices
|
||
|
|
- Quick tips
|
||
|
|
|
||
|
|
**When to Read:** When writing new Riverpod code
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
### Implementation Documents
|
||
|
|
|
||
|
|
#### [RIVERPOD_PRIORITY1_COMPLETED.md](./RIVERPOD_PRIORITY1_COMPLETED.md) ✅
|
||
|
|
**Purpose:** Documentation of completed Priority 1 work
|
||
|
|
**Audience:** All team members
|
||
|
|
**Key Content:**
|
||
|
|
- Linting setup (riverpod_lint, custom_lint)
|
||
|
|
- AGENTS.md updates
|
||
|
|
- Issues found and fixed
|
||
|
|
- Validation results
|
||
|
|
|
||
|
|
**Status:** ✅ **COMPLETE**
|
||
|
|
**When to Read:** To understand what's already been done
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
#### [RIVERPOD_PRIORITY2_PLAN.md](./RIVERPOD_PRIORITY2_PLAN.md) 📋
|
||
|
|
**Purpose:** Comprehensive migration plan for Priority 2
|
||
|
|
**Audience:** Migration contributors, technical leads
|
||
|
|
**Key Content:**
|
||
|
|
- All 39 providers to migrate
|
||
|
|
- 6 migration phases
|
||
|
|
- Detailed step-by-step instructions
|
||
|
|
- Testing plan
|
||
|
|
- Rollback procedures
|
||
|
|
- Risk mitigation
|
||
|
|
|
||
|
|
**Status:** 📋 **READY FOR IMPLEMENTATION**
|
||
|
|
**When to Read:** Before starting Priority 2 migration
|
||
|
|
**Size:** 33 KB, comprehensive guide
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
#### [RIVERPOD_PRIORITY2_QUICKREF.md](./RIVERPOD_PRIORITY2_QUICKREF.md) 📋
|
||
|
|
**Purpose:** Quick reference for daily migration work
|
||
|
|
**Audience:** Migration contributors
|
||
|
|
**Key Content:**
|
||
|
|
- Phase checklists
|
||
|
|
- Standard migration process
|
||
|
|
- Common commands
|
||
|
|
- Issue troubleshooting
|
||
|
|
- Quick examples
|
||
|
|
|
||
|
|
**Status:** 📋 **READY FOR USE**
|
||
|
|
**When to Read:** During active migration work
|
||
|
|
**Size:** 8 KB, concise reference
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
#### [RIVERPOD_PRIORITY2_TRACKER.md](./RIVERPOD_PRIORITY2_TRACKER.md) 📋
|
||
|
|
**Purpose:** Track migration progress
|
||
|
|
**Audience:** Migration contributors, project managers
|
||
|
|
**Key Content:**
|
||
|
|
- Progress charts
|
||
|
|
- Phase-by-phase checklists
|
||
|
|
- Testing checklists
|
||
|
|
- Issues log
|
||
|
|
- Time tracking
|
||
|
|
- Commit log
|
||
|
|
|
||
|
|
**Status:** 📋 **READY FOR USE**
|
||
|
|
**When to Read:** Daily during migration
|
||
|
|
**Size:** 11 KB, interactive tracker
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
### Example Documents
|
||
|
|
|
||
|
|
#### [docs/riverpod_migration_example.md](./docs/riverpod_migration_example.md)
|
||
|
|
**Purpose:** Step-by-step migration examples
|
||
|
|
**Audience:** All developers
|
||
|
|
**Key Content:**
|
||
|
|
- Before/after code comparisons
|
||
|
|
- Simple to complex examples
|
||
|
|
- Family provider examples
|
||
|
|
- Testing examples
|
||
|
|
- Common pitfalls
|
||
|
|
- IDE setup
|
||
|
|
|
||
|
|
**When to Read:** When migrating specific provider types
|
||
|
|
**Size:** Detailed examples with explanations
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 🚀 Migration Status
|
||
|
|
|
||
|
|
### Overview
|
||
|
|
|
||
|
|
```
|
||
|
|
Priority 1: ✅ COMPLETE
|
||
|
|
├── riverpod_lint added
|
||
|
|
├── custom_lint added
|
||
|
|
├── AGENTS.md updated
|
||
|
|
└── 1 safety issue fixed
|
||
|
|
|
||
|
|
Priority 2: 📋 PLANNED
|
||
|
|
├── Phase 1: 10 simple notifiers (4-6h)
|
||
|
|
├── Phase 2: 15 future providers (6-8h)
|
||
|
|
├── Phase 3: 4 family providers (2-3h)
|
||
|
|
├── Phase 4: 2 name-changing providers (4-6h)
|
||
|
|
├── Phase 5: 3 complex providers (6-8h)
|
||
|
|
└── Phase 6: 2 internal providers (1-2h)
|
||
|
|
|
||
|
|
Total Effort: 23-33 hours (4 weeks)
|
||
|
|
```
|
||
|
|
|
||
|
|
### Completed Work
|
||
|
|
|
||
|
|
✅ **Priority 1 Complete** (September 30, 2025)
|
||
|
|
- Linting infrastructure
|
||
|
|
- Documentation alignment
|
||
|
|
- Safety fixes
|
||
|
|
- Zero breaking changes
|
||
|
|
- All tests passing
|
||
|
|
|
||
|
|
### Upcoming Work
|
||
|
|
|
||
|
|
📋 **Priority 2 Ready** (Scheduled: October 2025)
|
||
|
|
- 39 providers to migrate
|
||
|
|
- 6 phases planned
|
||
|
|
- Comprehensive testing plan
|
||
|
|
- Clear rollback procedures
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 📊 Provider Migration Breakdown
|
||
|
|
|
||
|
|
### By Complexity
|
||
|
|
|
||
|
|
| Complexity | Count | Estimated Hours | Risk Level |
|
||
|
|
|------------|-------|-----------------|------------|
|
||
|
|
| 🟢 Simple | 28 | 12-16 | Low |
|
||
|
|
| 🟡 Medium | 8 | 7-10 | Medium |
|
||
|
|
| 🔴 Complex | 3 | 6-8 | High |
|
||
|
|
| **Total** | **39** | **25-34** | **Medium** |
|
||
|
|
|
||
|
|
### By Phase
|
||
|
|
|
||
|
|
| Phase | Providers | Hours | Risk | Status |
|
||
|
|
|-------|-----------|-------|------|--------|
|
||
|
|
| Phase 1 | 10 | 4-6 | 🟢 Low | Not Started |
|
||
|
|
| Phase 2 | 15 | 6-8 | 🟢 Low | Not Started |
|
||
|
|
| Phase 3 | 4 | 2-3 | 🟡 Medium | Not Started |
|
||
|
|
| Phase 4 | 2 | 4-6 | 🟡 Medium | Not Started |
|
||
|
|
| Phase 5 | 3 | 6-8 | 🔴 High | Not Started |
|
||
|
|
| Phase 6 | 2 | 1-2 | 🟢 Low | Not Started |
|
||
|
|
|
||
|
|
### By File
|
||
|
|
|
||
|
|
| File | Providers | Priority |
|
||
|
|
|------|-----------|----------|
|
||
|
|
| `lib/core/providers/app_providers.dart` | 26 | High |
|
||
|
|
| `lib/features/chat/providers/chat_providers.dart` | 5 | Medium |
|
||
|
|
| `lib/core/services/settings_service.dart` | 1 | High |
|
||
|
|
| Other files | 7 | Low |
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 🎓 Learning Path
|
||
|
|
|
||
|
|
### For New Contributors
|
||
|
|
|
||
|
|
1. **Day 1: Understand Riverpod 3.0**
|
||
|
|
- Read: RIVERPOD_SUMMARY.md
|
||
|
|
- Read: RIVERPOD_QUICKSTART.md
|
||
|
|
- Review: docs/riverpod_migration_example.md
|
||
|
|
|
||
|
|
2. **Day 2: Understand the Codebase**
|
||
|
|
- Read: RIVERPOD_3_ANALYSIS.md
|
||
|
|
- Review: RIVERPOD_PRIORITY1_COMPLETED.md
|
||
|
|
- Explore: Existing @riverpod providers in codebase
|
||
|
|
|
||
|
|
3. **Day 3: Prepare for Migration**
|
||
|
|
- Read: RIVERPOD_PRIORITY2_PLAN.md
|
||
|
|
- Familiarize: RIVERPOD_PRIORITY2_QUICKREF.md
|
||
|
|
- Setup: Development environment
|
||
|
|
|
||
|
|
4. **Day 4+: Start Migrating**
|
||
|
|
- Follow: Phase 1 checklist
|
||
|
|
- Use: RIVERPOD_PRIORITY2_QUICKREF.md
|
||
|
|
- Track: RIVERPOD_PRIORITY2_TRACKER.md
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 🛠️ Essential Commands
|
||
|
|
|
||
|
|
### Development
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# Start watch mode (recommended)
|
||
|
|
dart run build_runner watch --delete-conflicting-outputs
|
||
|
|
|
||
|
|
# Run all checks
|
||
|
|
flutter analyze && dart run custom_lint && flutter test
|
||
|
|
|
||
|
|
# Manual test
|
||
|
|
flutter run
|
||
|
|
```
|
||
|
|
|
||
|
|
### Migration
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# Check provider usage
|
||
|
|
grep -r "providerName" lib/ --exclude="*.g.dart" | wc -l
|
||
|
|
|
||
|
|
# Generate code
|
||
|
|
dart run build_runner build --delete-conflicting-outputs
|
||
|
|
|
||
|
|
# Run tests
|
||
|
|
flutter test
|
||
|
|
```
|
||
|
|
|
||
|
|
### Tracking
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# View progress
|
||
|
|
cat RIVERPOD_PRIORITY2_TRACKER.md
|
||
|
|
|
||
|
|
# Update tracker (edit the file after each migration)
|
||
|
|
# Mark providers as complete: ⬜ → ✅
|
||
|
|
```
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 📋 Quick Decision Tree
|
||
|
|
|
||
|
|
### "Which document should I read?"
|
||
|
|
|
||
|
|
```
|
||
|
|
Are you new to the project?
|
||
|
|
├─ Yes → Start with RIVERPOD_SUMMARY.md
|
||
|
|
└─ No
|
||
|
|
│
|
||
|
|
Are you migrating providers today?
|
||
|
|
├─ Yes
|
||
|
|
│ ├─ First time? → Read RIVERPOD_PRIORITY2_PLAN.md
|
||
|
|
│ └─ Continuing? → Use RIVERPOD_PRIORITY2_QUICKREF.md
|
||
|
|
│
|
||
|
|
└─ No
|
||
|
|
│
|
||
|
|
Need code examples?
|
||
|
|
├─ Yes → See docs/riverpod_migration_example.md
|
||
|
|
└─ No
|
||
|
|
│
|
||
|
|
Want to understand decisions?
|
||
|
|
├─ Yes → Read RIVERPOD_3_ANALYSIS.md
|
||
|
|
└─ No → Check RIVERPOD_QUICKSTART.md
|
||
|
|
```
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## ⚠️ Important Notes
|
||
|
|
|
||
|
|
### Before Starting Migration
|
||
|
|
|
||
|
|
1. ✅ **Verify Priority 1 is complete**
|
||
|
|
- Check: `pubspec.yaml` has `riverpod_lint` and `custom_lint`
|
||
|
|
- Check: `analysis_options.yaml` has `custom_lint` plugin
|
||
|
|
- Check: `dart run custom_lint` runs without errors
|
||
|
|
|
||
|
|
2. ✅ **Ensure clean git state**
|
||
|
|
- No uncommitted changes
|
||
|
|
- All tests passing
|
||
|
|
- On main branch (or feature branch)
|
||
|
|
|
||
|
|
3. ✅ **Read the plan**
|
||
|
|
- RIVERPOD_PRIORITY2_PLAN.md
|
||
|
|
- Understand the phase structure
|
||
|
|
- Know the rollback procedures
|
||
|
|
|
||
|
|
### During Migration
|
||
|
|
|
||
|
|
1. ✅ **Follow the phases in order**
|
||
|
|
- Don't skip ahead to complex providers
|
||
|
|
- Complete all providers in a phase before moving on
|
||
|
|
|
||
|
|
2. ✅ **Test frequently**
|
||
|
|
- After each provider migration
|
||
|
|
- Before committing
|
||
|
|
- After each phase
|
||
|
|
|
||
|
|
3. ✅ **Track progress**
|
||
|
|
- Update RIVERPOD_PRIORITY2_TRACKER.md
|
||
|
|
- Document issues
|
||
|
|
- Record learnings
|
||
|
|
|
||
|
|
4. ✅ **Commit frequently**
|
||
|
|
- One provider per commit (for simple ones)
|
||
|
|
- One phase per commit (for batches)
|
||
|
|
- Clear commit messages
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 🎯 Success Criteria
|
||
|
|
|
||
|
|
### Per Provider
|
||
|
|
|
||
|
|
- ✅ Code compiles without errors
|
||
|
|
- ✅ No lint warnings
|
||
|
|
- ✅ Tests pass
|
||
|
|
- ✅ Manual test successful
|
||
|
|
- ✅ Committed with clear message
|
||
|
|
|
||
|
|
### Per Phase
|
||
|
|
|
||
|
|
- ✅ All phase providers complete
|
||
|
|
- ✅ Full test suite passes
|
||
|
|
- ✅ Integration tests pass
|
||
|
|
- ✅ Multi-platform verification
|
||
|
|
|
||
|
|
### Overall Migration
|
||
|
|
|
||
|
|
- ✅ All 39 providers migrated
|
||
|
|
- ✅ Consistent code generation usage
|
||
|
|
- ✅ Zero regressions
|
||
|
|
- ✅ Documentation updated
|
||
|
|
- ✅ Team trained
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 📞 Getting Help
|
||
|
|
|
||
|
|
### If You're Stuck
|
||
|
|
|
||
|
|
1. **Check the troubleshooting section**
|
||
|
|
- RIVERPOD_PRIORITY2_QUICKREF.md has common issues
|
||
|
|
|
||
|
|
2. **Review examples**
|
||
|
|
- docs/riverpod_migration_example.md has similar cases
|
||
|
|
|
||
|
|
3. **Search the codebase**
|
||
|
|
- Look for existing @riverpod providers
|
||
|
|
- Find patterns that work
|
||
|
|
|
||
|
|
4. **Consult official docs**
|
||
|
|
- [Riverpod Code Generation](https://riverpod.dev/docs/concepts/about_code_generation)
|
||
|
|
- [Riverpod Migration Guide](https://riverpod.dev/docs/3.0_migration)
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 📈 Timeline
|
||
|
|
|
||
|
|
### Completed
|
||
|
|
|
||
|
|
- **September 30, 2025:** Priority 1 complete (linting setup) ✅
|
||
|
|
|
||
|
|
### Planned
|
||
|
|
|
||
|
|
- **Week 1 (Oct 1-5):** Phase 1 - Simple notifiers
|
||
|
|
- **Week 2 (Oct 8-12):** Phase 2 & 3 - Functions and families
|
||
|
|
- **Week 3 (Oct 15-19):** Phase 4 - Breaking changes
|
||
|
|
- **Week 4 (Oct 22-26):** Phase 5 & 6 - Complex providers
|
||
|
|
|
||
|
|
**Target Completion:** End of October 2025
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 📝 Contributing
|
||
|
|
|
||
|
|
When updating these documents:
|
||
|
|
|
||
|
|
1. **Keep them in sync**
|
||
|
|
- Update all relevant documents
|
||
|
|
- Maintain consistent information
|
||
|
|
|
||
|
|
2. **Document changes**
|
||
|
|
- Add date stamps
|
||
|
|
- Note what changed
|
||
|
|
|
||
|
|
3. **Update the index**
|
||
|
|
- Add new documents here
|
||
|
|
- Update status information
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 🔗 External Resources
|
||
|
|
|
||
|
|
### Official Documentation
|
||
|
|
|
||
|
|
- [Riverpod 3.0 Docs](https://riverpod.dev)
|
||
|
|
- [Code Generation Guide](https://riverpod.dev/docs/concepts/about_code_generation)
|
||
|
|
- [Migration Guide](https://riverpod.dev/docs/3.0_migration)
|
||
|
|
- [Riverpod Lint](https://riverpod.dev/docs/concepts/about_riverpod_lint)
|
||
|
|
|
||
|
|
### Community Resources
|
||
|
|
|
||
|
|
- [Riverpod Examples](https://github.com/rrousselGit/riverpod/tree/master/examples)
|
||
|
|
- [Flutter Community](https://flutter.dev/community)
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 📅 Document History
|
||
|
|
|
||
|
|
| Date | Document | Change | Author |
|
||
|
|
|------|----------|--------|--------|
|
||
|
|
| Sep 30, 2025 | RIVERPOD_PRIORITY1_COMPLETED.md | Created, Priority 1 complete | AI Assistant |
|
||
|
|
| Sep 30, 2025 | RIVERPOD_PRIORITY2_PLAN.md | Created, detailed plan | AI Assistant |
|
||
|
|
| Sep 30, 2025 | RIVERPOD_PRIORITY2_QUICKREF.md | Created, quick reference | AI Assistant |
|
||
|
|
| Sep 30, 2025 | RIVERPOD_PRIORITY2_TRACKER.md | Created, progress tracker | AI Assistant |
|
||
|
|
| Sep 30, 2025 | RIVERPOD_MIGRATION_INDEX.md | Created, master index | AI Assistant |
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 🎉 Conclusion
|
||
|
|
|
||
|
|
This comprehensive documentation suite provides everything needed for a successful Riverpod 3.0 migration. With clear plans, examples, and tracking tools, the migration can proceed smoothly and safely.
|
||
|
|
|
||
|
|
**Remember:**
|
||
|
|
- 📖 Read the docs
|
||
|
|
- 🧪 Test frequently
|
||
|
|
- 📝 Track progress
|
||
|
|
- 🤝 Ask for help
|
||
|
|
- 🎯 Stay focused
|
||
|
|
|
||
|
|
**Good luck with the migration! 🚀**
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
**Last Updated:** September 30, 2025
|
||
|
|
**Status:** Priority 1 Complete ✅ | Priority 2 Ready 📋
|
||
|
|
**Next Action:** Begin Phase 1 of Priority 2 migration
|