Skip to content

DSL for App - Convert DSL Language to Flutter Code using BLOC pattern

License

Notifications You must be signed in to change notification settings

eiffelqiu/AppDsl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

App DSL

Introduction

DSL for App

Convert DSL Language to Flutter Code using BLOC pattern

DSL code (example.ad)

# support 'dart' right now, will support 'swift' and 'java' in the future
format: dart

# generate main.dart for you
on: main

# generate router file (route_generator.dart) for you
on: route

# define counter bloc

bloc Counter {
    int counter;

    event INC {
        "+ 1"
    }

    event DEC {
        "- 1"
    }
}

# define timer bloc

bloc Timer {
    int counter;

    event INC {
        "+ 1"
    }

    event DEC {
        "- 1"
    }
}

# define post service

service post {
    api: "https://jsonplaceholder.typicode.com/posts"
    int id;
    int userId;
    string title;
    string body;
}

Usage


    $ java -jar bin/ad.jar dsl/example.ad

Generate Code

C:.
│  README.md
│  run.sh
│
├─bin
│      ad.jar
│
├─dsl
│      example.ad
│
└─gen
    │  main.dart
    │
    ├─bloc
    │  │  bloc.dart
    │  │  route_generator.dart
    │  │  simple_bloc_delegate.dart
    │  │
    │  ├─counter
    │  │      counter_bloc.dart
    │  │      counter_event.dart
    │  │      counter_page.dart
    │  │      counter_state.dart
    │  │
    │  └─timer
    │          timer_bloc.dart
    │          timer_event.dart
    │          timer_page.dart
    │          timer_state.dart
    │
    └─services
        └─post
                post.dart
                posts_widget.dart
                post_mixin.dart
                post_page.dart

About

DSL for App - Convert DSL Language to Flutter Code using BLOC pattern

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published