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

outdated

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
0
pub points
0%
popularity

Publisher

verified publisheriatec.com

A rest client base to make API requests.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

dio, flutter, http_parser

More

Packages that depend on restbase