artemis 0.1.3 copy "artemis: ^0.1.3" to clipboard
artemis: ^0.1.3 copied to clipboard

discontinuedreplaced by: ferry
outdated

Build dart types from a GraphQL schema (using Introspection Query).

Artemis

Pub Package

Build dart types from a GraphQL schema.

Artemis is a code generator that looks for *.schema.json (GraphQL Introspection Query response schema) and builds .api.dart files typing that schema. That's similar to what Apollo does.


Installation #

Add the following to your pubspec.yaml file:

dev_dependencies:
  artemis: <1.0.0
  build_runner: ^1.5.0
  json_serializable: ^3.0.0

ℹ️ Note that build_runner and json_serializable are required!

Then run:

pub packages get

or

flutter packages get

Now artemis will generate the API file for you by running:

pub run build_runner build

or

flutter pub run build_runner build

Custom Scalars #

If your schema uses custom scalars, they must be defined on build.yaml file on the root the project. If it needs a custom parser (to decode from/to json), the custom_parser_import path must be set and the file must implement both fromGraphQL___ToDart___ and fromDart___toGraphQL___ constant functions.

targets:
  $default:
    builders:
      artemis:
        options:
          custom_parser_import: 'package:graphbrainz_example/coercers.dart'
          scalar_mapping:
          - graphql_type: Date
            dart_type: DateTime

See examples for more information and configuration options.

173
likes
0
pub points
91%
popularity

Publisher

verified publisherborges.dev

Build dart types from a GraphQL schema (using Introspection Query).

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

analyzer, build, build_config, path, source_gen

More

Packages that depend on artemis