flutter_ast is a pure Dart library that enables serialization and deserialization between Dart files and Abstract Syntax Trees (ASTs). It facilitates code generation and server-driven UI by converting source code into AST structures and vice versa, supporting dynamic widget creation and manipulation. Designed for developers working with code generation or server-driven interfaces, it integrates seamlessly into Flutter projects across multiple platforms. The package is ideal for tools requiring programmatic analysis or transformation of Dart code.
Use cases
- Code generation from AST
- Server-driven UI rendering
- Dynamic widget creation
- Dart file analysis
- Automated code transformation
Key features
- Pure Dart implementation
- Bidirectional serialization (file ↔ AST)
- Supports code structure manipulation
- Lightweight and platform-agnostic
- Integrates with Flutter build systems
Suitable for
- Developers building code generators
- Teams using server-driven UI
- Tools requiring AST-level code processing
- Flutter plugin authors
- CI/CD pipeline integrators
Considerations
- Requires understanding of Dart AST structure
- Not intended for runtime code execution
- Best suited for build-time operations
- Limited to Dart language parsing
- May require additional tooling for complex transformations