zuraffa 1.11.1
zuraffa: ^1.11.1 copied to clipboard
AI first Flutter Clean Architecture Framework and CLI with Result types, UseCase patterns, Dependency Injection and MCP server for building type-safe, scalable apps with AI agents.
1.11.1 - 2026-02-01 #
Fixed #
-
Singleton Entity Key Collision: Fixed Hive storage key collision for singleton entities
- Now uses entity snake_case name as key instead of generic
'singleton' - Each entity gets unique storage:
GoogleCookie→'google_cookie',AppConfig→'app_config' - Prevents data overwriting between different singleton entities
- Now uses entity snake_case name as key instead of generic
-
Data Layer Generator: Fixed undefined
relativePathvariable in data repository generation- Added missing variable declaration in
generateDataRepositorymethod - Fixed import path string interpolation for data sources
- Ensures correct import paths when using subdirectories and caching features
- Added missing variable declaration in
1.11.0 - 2026-02-01 #
Added #
-
Initialize Command: New
zfa initializecommand to quickly create sample entities--entityparameter to specify entity name (default: Product)- Creates realistic sample entity with common fields (id, name, description, price, category, isActive, createdAt, updatedAt)
- Includes complete implementation with copyWith, equals, hashCode, toString, JSON serialization
- Added to MCP server as
initializetool for AI agent integration - Updated CLI help and README documentation
-
Singleton Entity Support: New
--id-field=nullflag for parameterless operations- Generates
get()andwatch()methods without ID parameters usingNoParams - Perfect for singleton entities like app config, user sessions, global settings
- Uses fixed
'singleton'key for Hive storage instead of entity ID - Validation prevents usage with list methods (
getList,watchList)
- Generates
Changed #
-
Optimized Repository Imports: Repository interfaces now conditionally import zuraffa
- Only imports
package:zuraffa/zuraffa.dartwhen using zuraffa types (ListQueryParams, UpdateParams, DeleteParams) - Simple repositories with only
get()methods have no zuraffa import - Keeps repository interfaces clean and minimal
- Only imports
-
Improved Local DataSource Generation:
- No
saveAll()method generated for singleton entities (--id-field=null) - Uses
'singleton'key for Hive operations instead of entity field access
- No
Fixed #
- Test Generation for Singleton Entities: Fixed mock repository calls in generated tests
- Parameterless methods now use
mockRepository.get()instead ofmockRepository.get(any()) - Fixed both success and failure test scenarios for Future and Stream UseCases
- Eliminates "too many arguments" compilation errors
- Parameterless methods now use
1.10.0 - 2026-02-01 #
Added #
- Caching Support: New dual datasource pattern for intelligent caching
--cacheflag to enable caching with remote and local datasources--cache-policyoption:daily,restart, orttl(default: daily)--cache-storageoption:hivefor Hive implementation (more coming soon)CachePolicyabstraction withDailyCachePolicy,AppRestartCachePolicy, andTtlCachePolicy- Automatic cache-aware repository generation with validity checks
- Complete Hive implementation when
--cache-storage=hiveis specified - Local datasource with
save(),saveAll(),get(),getList()methods - Remote datasource for API/external service calls
- Cache invalidation support via
CachePolicy.invalidate()
Changed #
- Remote and local datasources are now standalone implementations (no abstract interface)
- Updated to use
hive_ce_flutterpackage for Hive support
Fixed #
- Import paths in generated datasources and repositories
- Repository imports now correctly use
../../domain/paths
1.9.0 - 2026-01-31 #
Added #
- Test Generation (
--test): New flag to generate unit tests for generated UseCases with comprehensive mock setup and test scenarios.
1.8.0 - 2026-01-31 #
Added #
- New Failure Types: Added
StateFailure,TypeFailure,UnimplementedFailure,UnsupportedFailure, andPlatformFailuretoAppFailurefor granular error handling.
Changed #
- FailureHandler:
- Now uses a
switchstatement for improved performance and readability. - Correctly maps
PlatformException(Flutter) toPlatformFailure. - Maps
MissingPluginExceptiontoUnsupportedFailure. - Maps
ArgumentError,RangeError,FormatExceptiontoValidationFailure. - Maps
ConcurrentModificationError,StateError,StackOverflowErrortoStateFailure.
- Now uses a
- Generated Repositories: Fixed missing
zuraffaimport in generated repository files.
Fixed #
- TodoDataSource: Updated
InMemoryTodoDataSourceto fully implement the interface.
1.7.0 - 2026-01-31 #
Added #
- Typed Updates (
--morphy): New flag to generate update operations using typed Patch objects (e.g.,CustomerPatch) instead of Map-based partials. - Partial Updates: Default update mechanism now uses
Partial<T>(Map<String, dynamic>) with automatic field extraction for validation. - Validation:
UpdateParams.validate()automatically checks fields against your entity definition.FailureHandlernow catchesArgumentError(common in validation) and converts it toValidationFailure.
- New Parameter Wrappers:
ListQueryParams: Standardized params for list queries (filtering, sorting, pagination).DeleteParams: Standardized params for delete operations.UpdateParams<T>: Now generic over data type to support both Maps and Patch objects.
- CLI Global Flags:
--morphy: Enable Morphy-style patch objects.--id-field&--id-field-type: Customize the identifier field name and type (default: 'id', 'String').--query-field&--query-field-type: Customize the lookup field definition forget/watchmethods.
Changed #
- Scripts: Updated
publish.shto support "promote unreleased" workflow.
1.6.1 - 2026-01-31 #
1.6.0 - 2026-01-31 #
Change #
- fixed not overriding onInitState from CleanView, updated state generation to generate entity
1.4.1 - 2026-01-26 #
1.0.1 - 2026-01-23 #
Chore #
- Updated description in pubspec.yaml to better reflect package purpose and fit the required 180 character limit.
1.0.0 - 2026-01-23 #
Added #
Core Framework
- Result Type: Type-safe error handling with
Result<S, F>sealed class - AppFailure Hierarchy: Comprehensive sealed class hierarchy for error classification
ServerFailure- HTTP 5xx errorsNetworkFailure- Connection issuesValidationFailure- Input validation errorsNotFoundFailure- HTTP 404 / resource not foundUnauthorizedFailure- HTTP 401 / authentication requiredForbiddenFailure- HTTP 403 / access deniedTimeoutFailure- Request timeoutCacheFailure- Local storage errorsConflictFailure- HTTP 409 / version conflictsCancellationFailure- Operation cancelledUnknownFailure- Catch-all for unclassified errors
- UseCase: Single-shot operations returning
Future<Result<T, AppFailure>> - CompletableUseCase: Operations returning
Result<void, AppFailure> - StreamUseCase: Reactive operations returning
Stream<Result<T, AppFailure>> - BackgroundUseCase: CPU-intensive operations on isolates with
BackgroundTask - Controller: State management with automatic cleanup and lifecycle hooks
- Presenter: Optional orchestration layer for complex business flows
- CleanView & CleanViewState: Base classes for views with automatic lifecycle management
- ResponsiveViewState: Responsive layouts with device-specific builders
- ControlledWidgetBuilder: Rebuild widgets when Controller calls
refreshUI() - ControlledWidgetSelector: Fine-grained rebuilds based on selected values
- CancelToken: Cooperative cancellation for long-running operations
- NoParams: Sentinel for parameterless UseCases
- Observer: Optional callback-based stream listener
CLI Tool
- zfa CLI: Powerful code generator for Clean Architecture boilerplate
- Entity-based UseCase generation with
--methods - Custom UseCase generation with
--paramsand--returns - Repository interface generation with
--repository - Presentation layer generation with
--vpc - Data layer generation with
--data - Data source generation with
--datasource - State object generation with
--state - JSON output format with
--format=json - Stdin input support with
--from-stdin - Dry run mode with
--dry-run - Verbose logging with
--verbose - Force overwrite with
--force
- Entity-based UseCase generation with
- zfa validate: Validate JSON generation configs
- zfa schema: Get JSON schema for config validation
- Dual executable support: Both
zuraffaandzfacommands available
MCP Server
- zuraffa_mcp_server: Model Context Protocol server for AI/IDE integration
zuraffa_generatetool for code generationzuraffa_schematool for schema retrievalzuraffa_validatetool for config validation- Resource change notifications for generated files
- Precompiled binary support for faster startup
Extensions & Utilities
- Future Extensions: Convert futures to
Resulttype - Test Utilities: Matchers and test helpers
- Logging: Global logging configuration via
Zuraffa.enableLogging() - Controller Access:
Zuraffa.getController<T>()for accessing controllers from widget tree
Documentation
- Comprehensive README with quick start guide
- CLI Guide with all command options
- MCP Server documentation
- AI Agents guide for AI-assisted development
- Example application demonstrating all features
Features #
- Type-safe error handling: All operations return
Result<T, AppFailure>for exhaustive error handling - Sealed class hierarchies: Pattern matching with compile-time exhaustiveness checks
- Automatic cleanup: Controllers automatically cancel operations and subscriptions on dispose
- Fine-grained rebuilds: Optimized performance with selective widget updates
- Cooperative cancellation: CancelToken for cancelling long-running operations
- Background processing: Run CPU-intensive work on isolates without blocking UI
- Reactive streams: StreamUseCase for real-time data updates
- CLI code generation: Generate boilerplate with a single command
- AI/IDE integration: MCP server for seamless AI agent integration
- Testable: Pure domain layer with easy mocking and testing
Dependencies #
flutter: ^3.10.0args: ^2.7.0logging: ^1.3.0meta: ^1.12.0path: ^1.9.0provider: ^6.1.5+1responsive_builder: ^0.7.1flutter_lints: ^6.0.0 (dev)mocktail: ^1.0.4 (dev)
Documentation #
- Added comprehensive README with examples
- Added CLI Guide with all options
- Added MCP Server documentation
- Added AI Agents guide
- Added contributing guidelines
- Added code of conduct
Example Application #
- Complete Todo app demonstrating all framework features
- UseCase examples (single-shot, stream, background)
- Controller and View examples
- Error handling examples
- Cancellation examples
- State management examples
Planned Features #
- Web support for BackgroundUseCase
- Additional code generation templates
- More validation failure types
- Performance monitoring utilities
- Extended documentation and tutorials
Version Summary #
- 1.0.0 - Initial release with complete Clean Architecture framework, CLI tool, and MCP server