Nekos.Best Dart

CI Pub Package

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. Refer to the officials nekos.best docs for more info.

// Image response
{
  url: string,
  artist_href: string,
  artist_name: string,
  source_url: string,
}
// gif response
{
  url: string,
  anime_name: string,
}

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

Libraries

nekos_best
A minimal package to interact with nekos.best api