cynic 0.2.0 copy "cynic: ^0.2.0" to clipboard
cynic: ^0.2.0 copied to clipboard

Dart 1 only

Utilities for offline-first development.

cynic #

Utilities for offline-first development.

Warning: This is not an official Google or Dart project.

Usage #

This library works in Flutter and the standalone Dart VM.

dependencies:
  cynic: ^0.2.0

Determine online status #

import 'package:cynic/cynic.dart';

main() async {
  print('Connected: ${await isOnline()}');
}

Create and monitor a list of reachable services #

import 'package:cynic/cynic.dart';

final microServices = const [
  Reachable.googleDns, // 99.9% uptime helper
  const Reachable.ip('172.217.19.227', name: 'My API Server'),
];

final mirrors = const [
  const Reachable.ip('216.58.204.131', name: 'My CDN A'),
  const Reachable.ip('5.5.5.5', name: 'My CDN B'), // not online
];

main() async {
  var all = await Reachable.all(microServices);
  if (all) {
    print('All servers are online');
  }
  var any = await Reachable.any(mirrors);
  if (any) {
    print('At least one server is online');
  }
}
0
likes
30
pub points
0%
popularity

Publisher

unverified uploader

Utilities for offline-first development.

Repository (GitHub)
View/report issues

License

BSD-3-Clause (LICENSE)

Dependencies

meta

More

Packages that depend on cynic