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

Get various jokes from JokeAPI without any API token, membership, registration or payment.

example/jokeapi_example.dart

import 'package:jokeapi/jokeapi.dart';

void main() async {
  final jokeApi = JokeApi();

  final jokes = [
    ...(await jokeApi.getJokes(type: JokeType.single)).jokes,
    ...(await jokeApi.getJokes(type: JokeType.twoPart)).jokes,
    ...(await jokeApi.getJokes(amount: 10)).jokes,
  ];

  for (final joke in jokes) {
    print('Let me tell you a joke!');
    switch (joke) {
      case SingleJoke():
        print(joke.joke);
      case TwoPartJoke():
        print(joke.setup);
        print(joke.delivery);
    }
    print('Did you get it?');
    print('');
  }
}
2
likes
160
points
65
downloads

Publisher

verified publishermichaeldark.dev

Weekly Downloads

Get various jokes from JokeAPI without any API token, membership, registration or payment.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

http, json_annotation, path

More

Packages that depend on jokeapi