Skip to content

Latest commit

 

History

History
53 lines (40 loc) · 2.26 KB

getting_started.md

File metadata and controls

53 lines (40 loc) · 2.26 KB

Getting started

  1. Create a demo web app:

    • dart create -t web-simple my-app

    Having troubles? learn more from official guide

  2. Add Rad as dependency:

    • Open pubspec.yaml in newly created app folder and add rad to your dependencies:
      dependencies:
        rad: '>=1.8.0 <2.0.0'
  3. Run dart pub get.

  4. Import Rad widgets in your main.dart:

    import 'package:rad/rad.dart';
  5. Create App:

    void main() {
      runApp(
                            // 'output' is the id of div in your web/index.html
                            // framework will mount your app inside that div
                            // if you don't have a div with id 'output' in web/index.html, 
        appTargetId: "output", // you've to create it
                            // e.g
                            //    <body>
                            //      <div id="output"></div> 
                            //    ...
        app: Text("hello world"),
      );
    }
  6. Run webdev serve and follow on-screen instructions.

Debugging

For debugging a Dart web app, you've to setup a debugger for your IDE/editor. See Dart guide for debugging web apps and tools that you can use. (remember you don't need Flutter SDK/or its plugins for using Rad).

If you happen to be using VS code,

Deployment

For getting a release build run webdev build --release. It'll generate a ready-to-deploy build of your app inside build folder. To customize your build, read this official deployment guide. Note that optimization level can be controlled. Refer to dart2js docs for options available. Alternatively, you can also follow webdev documentation.