brick_rest_generators 3.2.1 copy "brick_rest_generators: ^3.2.1" to clipboard
brick_rest_generators: ^3.2.1 copied to clipboard

Code generation library for the REST providers, models, and adapters in Brick

brick_rest_generators workflow

Brick Rest Build #

Code generator that provides (de)serializing functions for Brick adapters using RestProvider. This package does not produce code. It can be imported into other Brick build domains.

This package should not be imported into an end application as it does not generate code.

Usage #

Apply the RestSerdes in your own AnnotationSuperGenerator:

import 'package:brick_rest_generators/rest_serdes.dart';

class MyDomainGenerator extends AnnotationSuperGenerator<ConnectMyDomainWithRest> {
  final String superAdapterName;
  final String repositoryName;

  const OfflineFirstGenerator({
    this.superAdapterName = 'MyDomain',
    this.repositoryName = 'MyDomainWithRest',
  });

  /// Given an [element] and an [annotation], scaffold generators
  List<SerdesGenerator> buildGenerators(Element element, ConstantReader annotation) {
    final rest = RestSerdes(element, annotation, repositoryName: repositoryName);
    final otherProvider = OtherProviderSerdes(element, annotation, repositoryName: repositoryName);
    final generators = <SerdesGenerator>[];
    generators.addAll(rest.generators);
    generators.addAll(otherProvider.generators);
    return generators;
  }
}
0
likes
140
points
823
downloads

Publisher

unverified uploader

Weekly Downloads

Code generation library for the REST providers, models, and adapters in Brick

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

analyzer, brick_build, brick_core, brick_json_generators, brick_rest, build, dart_style, source_gen

More

Packages that depend on brick_rest_generators