Adding Hydro-SDK content to an existing Flutter app.
This tutorial assumes you have an existing Flutter app project and the
npx commands globaly available. https://docs.npmjs.com/cli/v7
Hydro-SDK is distributed both through
Run the following in the root of your Flutter app project to initialise your project's
Depend on a version of Hydro-SDK, for example
Add the following to your
It's important that Hydro-SDK is included as a
dependency and NOT a
devDependency in both
pubspec.yaml. Once Hydro-SDK is mature enough, it will be available as a separate
Run the following to download Hydro-SDK from
By convention, code intended to be run by Hydro-SDK is placed into a directory named
ota in the root of your project. The following is a TypeScript version of the Flutter counter showcase. Place it into a file named
Hydro builds and manages code in terms of projects. Each project consists of one component. Each component consists of one bytecode chunk. Bytecode chunks are the result of compiling source files starting from an entrypoint.
In the future it is likely that projects may have many components and that components may have many chunks.
Save the following to a file called
hydro.json in the root of your Flutter project:
The above describes how we will address our code (
example-project/counter-example) as well as how to build it.
Hydro content can be placed anywhere a regular widget can (including in
runApp in your
main function). Include the following where you would like to run the counter example:
lib/main.dart with the debugging tools in your favourite IDE or with
flutter run. In a terminal, run
npx hydroc run. The
hydroc command is the interface to the Hydro-SDK SDK-Tools. If this is the first time running
hydroc in this directory, it will first download the required SDK-Tools for the Hydro-SDK release you depend on in your
npx hydroc run is running, changes made to
ota/index.ts will be reflected in your running app.
Note: Debugging on real-devices is currently not possible.