reflutter 0.2.2 copy "reflutter: ^0.2.2" to clipboard
reflutter: ^0.2.2 copied to clipboard

outdatedDart 1 only

A library to generate HTTP clients from metadata specified by users. The thought is that this can be used by Flutter based mobile apps to connect to their backend resources.

example/example.dart

library reflutter.example;

import 'dart:async';
import 'package:http/http.dart';
import 'package:jaguar_serializer/jaguar_serializer.dart';
import 'package:reflutter/reflutter.dart';
import 'models/user.dart';

part 'example.api.dart';

/// definition
@ReflutterHttp(name: 'Api')
abstract class ApiDefinition {
  @Get('/users/:id')
  Future<ReflutterResponse<User>> getUserById(@Param() String id);

  @Post('/users')
  Future<ReflutterResponse<User>> postUser(@Body() User user);

  @Put('/users/:uid')
  Future<ReflutterResponse<User>> updateUser(
      @Param('uid') String userId, @Body() User user);

  @Delete('/users/:id')
  Future<ReflutterResponse> deleteUser(@Param() String id);

  @Get('/users')
  Future<ReflutterResponse<List<User>>> search(
      @QueryParam('n') String name, @QueryParam('e') String email);
}
0
likes
0
pub points
0%
popularity

Publisher

unverified uploader

A library to generate HTTP clients from metadata specified by users. The thought is that this can be used by Flutter based mobile apps to connect to their backend resources.

Homepage

License

unknown (LICENSE)

Dependencies

analyzer, build, code_builder, dart_style, http, jaguar_generator_config, jaguar_serializer, logging, meta, source_gen

More

Packages that depend on reflutter