advices_slip_api 1.0.1 copy "advices_slip_api: ^1.0.1" to clipboard
advices_slip_api: ^1.0.1 copied to clipboard

An unofficial wrapper around the AdvicesSlip JSON API for providing random advice slips.

Advice Slips API Wrapper

An unofficial wrapper for the Advice Slip JSON API to embed into your Dart/Flutter apps.

Install it here

Installation #

pubspec.yaml:

dependencies:
    advices_slip_api: x.x.x

Command Line

[dart/flutter] pub add advices_slip_api

Usage #

import "package:advices_slip_api/advices_slip_api.dart";

Available Functions

randomAdvice() - Get a random advice

findAdvice(query) - Find advices given a keyword to use to find

getAdviceById(id) - Find an advice by its canonical id

Example Usage: #

import "package:advices_slip_api/advices_slip_api.dart";

void main() async {
  (await AdviceSlipsApi.randomAdvice())
      .onSuccess((AdviceSlip advice) => print(advice))
      .onFailure((Exception e) => print(e));
  (await AdviceSlipsApi.findAdvice("life"))
      .onSuccess((List<AdviceSlip> advice) => print(advice))
      .onFailure((Exception e) => print(e));
  (await AdviceSlipsApi.findAdvice("life"))
      .onSuccess((List<AdviceSlip> advice) => print(advice))
      .onFailure((Exception e) => print(e));
}
1
likes
140
points
63
downloads

Publisher

verified publisherexoad.net

Weekly Downloads

An unofficial wrapper around the AdvicesSlip JSON API for providing random advice slips.

Repository (GitHub)
View/report issues

Documentation

API reference

License

unknown (license)

Dependencies

http_requests, json_annotation, json_serializable, result_dart

More

Packages that depend on advices_slip_api