rollapi library

This is the main file that exports all others

Import it like: "import 'package:rollapi/rollapi.dart' as roll;"

Classes

Request
Class representing a single request. All properties are immutable, and new states are emitted by stateStream

Enums

RequestState
This file contains enums etc to represent the state of the Request State of the request. Whether it's already finished, or waiting in a queue, etc

Constants

requestErrorStates → const List<RequestState>
List of states which represent that request failed
requestWaitingStates → const List<RequestState>
List of states which represent that request is waiting

Properties

API_BASE_URL String
Base URL where API lives - must end with the '/'
getter/setter pair
HEADERS Map<String, String>
getter/setter pair

Functions

getRandomNumber() Future<int>
![Chosen by a fair dice roll, guaranteed to be random](https://raw.githubusercontent.com/TheLastGimbus/rollapi_dart/master/images/xkcd_221_random_number.png]
isAvailable() Future<bool>
Checks if instance under API_BASE_URL is available right now
makeRequest() Future<Request>
Makes new requests
requestStateFromName(String string) RequestState
stateStream(String uuid) Stream<MapEntry<RequestState, dynamic>>
Stream of states for given uuid request. Can be useful for example for re-checking state after network loss. Otherwise just use makeRequest

Exceptions / Errors

ApiException
This file contains all the exceptions Generic exception that something messed up with API
ApiUnavailableException
Represents that while the base URL is ping-able, the API backend is currently unavailable for some reason - for example, maintenance
RateLimitException
Represents that rate limit was exceeded and you need to wait to make new requests