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

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 = 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);
  var 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
120
pub points
24%
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

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

http, logging, pedantic

More

Packages that depend on fnx_rest