Skip to main content

adaj 0.1.1 copy "adaj: ^0.1.1" to clipboard
adaj: ^0.1.1 copied to clipboard

Dart 1 only

Primitive utility for asynchronous JSON requests with Dart. Sending JSON data is supported, as well, as simple success/error/always callbacks

Build Status

##Description

Primitive utility for asynchronous JSON requests with Dart. Sending JSON data is supported, as well, as simple success/error/always callbacks

Usage #

Add dependency in your pubspec.yaml

dependencies:
  adaj: any

and run

pub install

Import library

import "package:adaj/adaj.dart" as http;

and now you can make adaj (Asynchronous Dart and JSON) calls

http.get("http://httpbin.org/get").done((json) {
  print(json["url"]); //prints "http://pastebin.org/get"
}).go();

Sending data with post

Map data = {"test": 42};
http.post("http://httpbin.org/post", data).done((json) {
  print(json);
}).go();

PUT and POST are supported in a similar way. For other HTTP methods you can use ajax(url, {method, data}) method.

http.ajax("http://httpbin.org/", method: "HEAD", data: {}).go();

You also have .fail() and .always() callback hooks and you can chain them as much as you like

http.get(...).done(...).fail(...).always(...).done(...) /* and so on */ .go();
0
likes
25
points
89
downloads

Publisher

unverified uploader

Weekly Downloads

Primitive utility for asynchronous JSON requests with Dart. Sending JSON data is supported, as well, as simple success/error/always callbacks

Repository (GitHub)
View/report issues

License

BSD-2-Clause (license)

Dependencies

browser, unittest

More

Packages that depend on adaj