Getting Started

Your project will need three packages, one each for Flutter and the web, and a base package they will share.

Create this minimal directory structure, and add READMEs etc. as you see fit.

<project_name>

packages/

<project_name>/

<project_name>_mobile/

<project_name>_web/

Generate the Packages

The name of each package directory will be the name of the generated package. Afterwards we’ll rename the directories to make things simpler.

Before doing this you may want to ensure your version of stagehand and flutter are up to date.

> pub global activate stagehand > flutter upgrade

Generate the base package by entering the following from the packages/<project_name> directory.

> stagehand package-simple > pub get

Delete everything inside the generated lib/ directory, we're going to create our own files.

2. Generate the web package by entering the following from the packages/<project_name>_web directory.

> stagehand web-angular > pub get

3. Generate the mobile package by entering the following from the packages/<project_name>_mobile directory.

> flutter create .

Now that the packages have been created with their desired names, we can rename the directories to make things easier.

<project_name>

packages/

base/

mobile/

web/

Add Dependencies

Add the following dependencies to each package. Do not delete the existing ones.

Be sure to use the latest version of each dependency. A quick way to check is to add the dependency without a version constraint, and then check the version that is added to the .packages file.

In the base project’s pubspec.yaml , add the following dependency.

dependencies:

shared_theme: ^0.1.2

For the mobile package, add these dependencies.

dependencies:

<project_name>:

path: ../base

shared_theme_flutter: ^0.1.2

shared_preferences: ^0.4.2 # For persisting theme preference.

The web packages requires a dev dependency as well.

dependencies:

<project_name>:

path: ../base dev_dependencies:

sass_builder: ^2.1.1

Name the App

Since both apps are going to use the same user-facing name let’s define it in base/lib/config.dart .