Skip to content
Docs
Components
Example Flutter App

Flutter

In order to use Flutter, please install Flutter (opens in a new tab) and Android Studio (opens in a new tab).

I personally use IntelliJ IDEA, but Android Studio is the official IDE for Flutter.

Create a new Flutter project

To create a new Flutter project, run the following command:

flutter create my_app

Run the app

To run the app, open the project in Android Studio and click on the green play button. However, if you are cli junkie, you can run the following command:

flutter run

If you are on MacOS, please ensure that you have XCode installed if you want to run the app on iOS and download the Android SDK if you want to run the app on Android.

Once you have set up Flutter successfully, you can try running it with Dartive and Dartivemon!

In your file directory, add the following files: Where app.dart contains a Dartive application, here is a code snippet to get you started:

import 'package:dartive/dartive.dart';
 
void main(List<String> arguments) async {
  Dartive.get('/', () {
    print("This is running");
 
    return {'Hello World'};
  });
 
  Dartive.post('/test', (Dartive api) async {
    var body = api.request;
 
    return body;
  });
 
  await Dartive.listen(host: '0.0.0.0', port: 8000);
}
      • app.dart
  • Once that is done, you can test the endpoint, by throwing a get request it by going to your browser and going to http://localhost:8000 (opens in a new tab).

    You should see the following:

    {
      "data": ["Hello World"]
    }

    This is a very brief example of how you can have both the backend and frontend running at the same time with Dartive!