API class

backend Singleton to provide all functionality related to the backend

Constructors

API.new()
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
isAnyoneLoggedIn Future<bool>
checks whether anyone is currently logged in
no setter
local LocalMirror
final
remote Remote
final
rootID Future<String>
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
user Future<DisplayUser?>
gets the currently logged in DisplayUser, which is the current User but with removed User.pass to avoid abuse
no setter

Methods

delete<DataT extends Data>(DataT? data, {Data? caller}) Future<String?>
deletes a DataT and returns the response
deleteImageByHash<DataT extends Data>(DataT? data, String hash, {Data? caller, bool forceUpdate = false}) Future<String?>
deletes an image specified by its hash and returns the response
getDocument(String path) Future<File?>
getImageByHash(String hash, {bool compressed = false}) Future<ImageData<Object>?>
gets image specified by its hash
getNextDatapoint<ChildData extends Data, ParentData extends WithOffline?>(ParentData data, {bool preloadFullImages = false}) Stream<List<ChildData>>
gets all the ChildDatapoints for the given ParentData if no ParentData is given it defaults to root
isUserLoggedIn(User user) Future<bool>
checks whether the given user is currently logged in
login(User user) Future<DisplayUser?>
login a User by checking if he exists in the remote database
logout() Future<void>
removes the credentials from local storage and therefors logs out
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
postJSONWithSocketRetry(RequestData requestData, {int maxRetries = 3, Duration retryDelay = const Duration(seconds: 2)}) Future<Response?>
Versucht, einen HTTP-Request unter Berücksichtigung möglicher Socket-Fehler durchzuführen Diese Methode erweitert die bestehende postJSON-Methode und fügt Wiederverbindungs-Logik hinzu
setMainImageByHash<DataT extends Data>(DataT? data, String mainhash, {Data? caller, bool forceUpdate = false}) Future<String?>
setNew<DataT extends Data>(DataT? data, {Data? caller}) Future<DataT?>
sets a new DataT
toString() String
A string representation of this object.
inherited
tryNetwork({Duration? timeout, required SimulatedRequestType requestType}) Future
checks whether a connection to the network is allowed throws NoConnectionToBackendException or SocketException if its not.
update<DataT extends Data>(DataT? data, {Data? caller, bool forceUpdate = false}) Future<String?>
updates a DataT and returns the respons
uploadNewImagesOrFiles<DataT extends Data>(DataT data, List<XFile> files, {Data? caller, bool forceUpdate = false}) Future<String?>
upload / add a bunch of images

Operators

operator ==(Object other) bool
The equality operator.
inherited