Why Migrate to Dart?
Basic Conversion Rules
Widget Types
JSONtype fields map to Stac + PascalCase class names:
Action Types
JSONactionType fields map to Stac + PascalCase + Action:
Step-by-Step Migration
Step 1: Simple Widget
Before (JSON):Step 2: Widget with Properties
Before (JSON):Step 3: Nested Widgets
Before (JSON):Step 4: Actions
Before (JSON):Step 5: Complex Styles
Before (JSON):Common Patterns
Padding/Margin
JSON:Colors
Enums
JSON string values become Dart enums:Full Screen Migration Example
Before (JSON file:home_screen.json):
stac/home_screen.dart):
Build and Deploy
After migrating, build your Dart to JSON:stac/.build/.
Tips
- Start small: Migrate one screen at a time
- Use IDE features: Leverage autocompletion and error checking
- Run
stac buildoften: Catch errors early - Compare output: Verify generated JSON matches your expectations
- Keep JSON backups: Until you’re confident in your migration