fnx_rest 2.1.1 copy "fnx_rest: ^2.1.1" to clipboard
fnx_rest: ^2.1.1 copied to clipboard

outdated

Angular and Flutter friendly RestClient, which will make your communication with REST APIs much simpler.

example/main.dart

import 'package:fnx_rest/fnx_rest_io.dart';

void main() async {
  // Init your Rest API client
  RestClient apiRoot = new IoRestClient.root(
      "https://jsonplaceholder.typicode.com"); // Use BrowserRestClient in browser ..

  // configure global headers
  apiRoot.setHeader("Authorization", "FacelessMan");

  // follow serverside endpoints structure ...
  var apiUsers = apiRoot.child("/users");
  print(apiUsers.url);
  RestResult rr = await apiUsers.get();
  if (!rr.success) rr.throwError();
  print(rr.data);

  // follow serverside endpoints structure ...
  var myApiUser = apiUsers.child("/1");
  print(myApiUser.url);
  rr = await myApiUser.get();
  if (!rr.success) rr.throwError();
  print(rr.data);

  // customize payload handling
  // var myApiUserPhoto = myApiUser.child("/photo");
  // myApiUserPhoto.acceptsBinary("image/png");
}
10
likes
40
pub points
38%
popularity

Publisher

verified publisherfnx.io

Angular and Flutter friendly RestClient, which will make your communication with REST APIs much simpler.

Repository (GitHub)
View/report issues

License

BSD-3-Clause (LICENSE)

Dependencies

http, logging

More

Packages that depend on fnx_rest