Skip to main content

axiom_flutter_generator 0.150.1 copy "axiom_flutter_generator: ^0.150.1" to clipboard
axiom_flutter_generator: ^0.150.1 copied to clipboard

Generates a typed Dart client for axiom_flutter from an Axiom contract. Run by `axiom pull --framework flutter`.

example/README.md

axiom_flutter_generator example #

The generator is a command-line tool, run by the axiom CLI.

In a Flutter project with axiom_flutter in dependencies and axiom_flutter_generator in dev_dependencies:

axiom pull ../backend/backend.axiom --framework flutter --name todos --out lib/axiom_generated

This writes lib/axiom_generated/axiom_sdk.dart and models.dart. Use them:

import 'package:axiom_flutter/axiom_flutter.dart';
import 'package:flutter/material.dart';

import 'axiom_generated/axiom_sdk.dart';
import 'axiom_generated/models.dart' as models;

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  final sdk = await AxiomSdk.create();
  final models.Greeting greeting =
      await sdk.todos.hello(name: 'Ada').stream.unwrap();
  debugPrint(greeting.message);
}

To regenerate without pulling the contract again:

dart run axiom_flutter_generator:generate --config AxiomDeps.toml --out axiom_generated

A complete app, with the backend contract and the generated files, is in axiom_flutter/example.

1
likes
160
points
610
downloads

Documentation

Documentation
API reference

Publisher

verified publisheryashmakan.com

Weekly Downloads

Generates a typed Dart client for axiom_flutter from an Axiom contract. Run by `axiom pull --framework flutter`.

Repository (GitHub)
View/report issues

Topics

#codegen #api #network

License

MIT (license)

Dependencies

args, collection, crypto, path, toml, yaml

More

Packages that depend on axiom_flutter_generator