nekos_best 1.0.0 copy "nekos_best: ^1.0.0" to clipboard
nekos_best: ^1.0.0 copied to clipboard

A dart package for interacting with nekos.best api.

Nekos.Best Dart #

CI Pub Package package publisher

A minimal Dart package for interacting with Nekos.best api.

Getting started #

Add the package to your project's pubspec.yaml file. You can use the dart cli

$ dart pub add nekos_best

Usage #

Import the package in your dart file and use the methods

import 'package:nekos_best/nekos_best.dart' as nb;

var res = nb.fetch('neko');

Methods #

Future<Map<String, dynamic>> fetch([String? endpoint]) #

Fetch results from an optionally specified category. If mentioned, it'll fetch from that category. If not mentioned, it will use a random category. Returns a single response map

Future<List<Map<String, dynamic>>> fetchMultiple(String endpoint, {int amount = 5}) #

Fetch multiple results from a specified endpoint. Endpoint is must, the amount is optional. If left unspecified, it defaults to 5. Maximum is 20. If provided value is more than 20, it resets to 20. Returns a list of response map

Examples are in example/fetch.dart file.

Response #

A nb response has the following fields. The url property is always present. If the endpoint returns a static image, artist_href and artist_name might be present, the other two will be absent. If the endpoint returns a gif image, source_url and anime_name might be present, the other two will be absent. Refer to the officials nekos.best docs for more info.

{
  url: string,
  artist_href: string | undefined,
  artist_name: string | undefined,
  source_url: string | undefined,,
  anime_name: string | undefined,
}

You can access the fields like you would for a Map class.

var neko = nb.fetch('neko');
print('Neko url: ${neko["url"]} Neko artist: ${neko["artist_name"]}');

Author #

nekos_best_dart © Yakiyo. Authored and maintained by Yakiyo.

Released under MIT License

2
likes
0
pub points
12%
popularity

Publisher

unverified uploader

A dart package for interacting with nekos.best api.

Homepage
Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

http

More

Packages that depend on nekos_best