Skip to main content
This guide helps you migrate existing Stac JSON configurations to the new Dart format. The Dart provides type safety, IDE autocompletion, and a more natural development experience.

Why Migrate to Dart?

Basic Conversion Rules

Widget Types

JSON type fields map to Stac + PascalCase class names:

Action Types

JSON actionType fields map to Stac + PascalCase + Action:

Step-by-Step Migration

Step 1: Simple Widget

Before (JSON):
After (Dart):

Step 2: Widget with Properties

Before (JSON):
After (Dart):

Step 3: Nested Widgets

Before (JSON):
After (Dart):

Step 4: Actions

Before (JSON):
After (Dart):

Step 5: Complex Styles

Before (JSON):
After (Dart):

Common Patterns

Padding/Margin

JSON:
Dart:

Colors

Enums

JSON string values become Dart enums:

Full Screen Migration Example

Before (JSON file: home_screen.json):
After (Dart file: stac/home_screen.dart):

Build and Deploy

After migrating, build your Dart to JSON:
The generated JSON will be placed in stac/.build/.

Tips

  1. Start small: Migrate one screen at a time
  2. Use IDE features: Leverage autocompletion and error checking
  3. Run stac build often: Catch errors early
  4. Compare output: Verify generated JSON matches your expectations
  5. Keep JSON backups: Until you’re confident in your migration