restbase 0.4.0 copy "restbase: ^0.4.0" to clipboard
restbase: ^0.4.0 copied to clipboard

A rest client base to make API requests.

rest #

A rest client base to make API requests.

Example

class LoginApi extends Rest {
  LoginApi() {
    this.addInterceptor(PrintLogInterceptor());
  }

  @override
  String get restUrl => BASE_AUTH_URL_API;

  Future<RestResult<User>> login(String user, String password) =>
      postModel("/login", { "user": user, "password": password }, User.fromJson);
}

class User {
    int id;
    String userName;
    String token;

    static User fromJson(Map<String, dynamic> json) {
        ///... parse json to User
    }

    Map<String, dynamic> toJson() {
        //... properties to map
    }
}
8
likes
100
pub points
34%
popularity

Publisher

verified publisheriatec.com

A rest client base to make API requests.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

dio, flutter, http_parser

More

Packages that depend on restbase