coffee_http 0.2.3 copy "coffee_http: ^0.2.3" to clipboard
coffee_http: ^0.2.3 copied to clipboard

outdatedDart 1 only

Easy http request

example/main.dart

/**
 * Created by lejard_h on 25/04/16.
 */

import "dart:async";
import "package:coffee_http/coffee.dart";
import "models/models.dart";
import "api/api.dart";

Future<Null> main() async {
  initApi();

  api["resources"].execute().then((CoffeeResponse _res) {
    print(_res.decodedBody as List<ResourceModel>);
  });

  api["resources"]["create"]
      .execute(body: new ResourceModel()
        ..name = "truc"
        ..capacity = 3)
      .then((CoffeeResponse _res) {
    if (_res.statusCode == 200) {
      ResourceModel resource = _res.decodedBody as ResourceModel;
      print(resource);
    }
  });

  api["resources"]["read"].execute(parameters: {"name": "truc"}).then((CoffeeResponse _res) {
    if (_res.statusCode == 200) {
      ResourceModel resource = _res.decodedBody as ResourceModel;
      print(resource);
    }
  });
}
0
likes
0
pub points
0%
popularity

Publisher

unverified uploader

Easy http request

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

convert, http

More

Packages that depend on coffee_http