Skip to main content

sinew_network 1.1.0 copy "sinew_network: ^1.1.0" to clipboard
sinew_network: ^1.1.0 copied to clipboard

SinewHttp (Dio), the auth layer, processApiCall, retry, polling and NetworkChecker.

example/README.md

sinew_network example #

A complete app that uses this package, with every platform runner, is the repository's example: a paged list of orders through Sinew's pager, its Riverpod mixins and Camouflage's CamoPagedList.

Usage #

final config = SinewConfig(
  baseUrl: 'https://api.example.com/v1',
  locale: () => 'en',
  anonymousPaths: {'/auth/login'},
);
final dio = SinewHttp.dio(config, tokenSource);

// In a repository: any failure becomes a typed SinewException.
Future<Result<Order>> cancel(String id) =>
    processApiCall('ORD', 'CANCEL', () => api.cancel(id));

API classes use paths relative to baseUrl (get('orders')), since a leading / would replace its own path. On sign-out, call SinewHttp.resetAuth(dio) and tokenSource.clear().

0
likes
160
points
306
downloads

Documentation

Documentation
API reference

Publisher

verified publishersrctool.com

Weekly Downloads

SinewHttp (Dio), the auth layer, processApiCall, retry, polling and NetworkChecker.

Repository (GitHub)
View/report issues
Contributing

Topics

#http #dio #networking #authentication

License

Apache-2.0 (license)

Dependencies

connectivity_plus, dio, flutter, sinew_exception, sinew_models

More

Packages that depend on sinew_network