simple_auth_generator 1.0.4 copy "simple_auth_generator: ^1.0.4" to clipboard
simple_auth_generator: ^1.0.4 copied to clipboard

outdated

simple_auth is an http client generator using source_gen and inspired from retrofit and chopper

Simple Auth Generator #

This is the API Generator for Simple Auth

Usage #

Dart #

pub run build_runner build

flutter #

flutter packages pub run build_runner build

Add the following to your pubspec.yaml

dev_dependencies:
  simple_auth_generator: 
  build_runner: ^0.8.0

The Generator is not required, however it will make things magical.

@GoogleApiDeclaration("GoogleTestApi","client_id",clientSecret: "client_secret", scopes: ["TestScope", "Scope2"])
abstract class GoogleTestDefinition {
  @Get(url: "https://www.googleapis.com/oauth2/v1/userinfo?alt=json")
  Future<Response<GoogleUser>> getCurrentUserInfo();
}

will generate a new Api for you that is easy to use!

var api = new GoogleTestApi("google");
var user = await getCurrentUserInfo();

For more examples, check out the example project

Serialization #

Json objects will automatically serialize if you conform to JsonSerializable

If you use the generator and you objects have the factory factory JsonSerializable.fromJson(Map<String, dynamic> json) your api calls will automatically Serialize/Deserialize

Or you can pass your own Converter to the api and handle conversion yourself. \

0
likes
30
pub points
6%
popularity

Publisher

unverified uploader

simple_auth is an http client generator using source_gen and inspired from retrofit and chopper

Repository (GitHub)
View/report issues

License

MIT (LICENSE)

Dependencies

analyzer, build, build_config, code_builder, dart_style, logging, meta, path, simple_auth, source_gen

More

Packages that depend on simple_auth_generator