noq 1.0.4
noq: ^1.0.4 copied to clipboard
NoQ SDK for Flutter application.
NoQ Flutter SDK #
Usage #
initialize noq object #
final noq = NoQ(
clientID: "<your client ID>",
)
enquene #
final result = await noq.enqueue();
switch (result) {
case EnqueueResultWait():
if (!context.mounted) return;
final token = await Navigator.push(
context,
MaterialPageRoute(
builder: (context) => WaitingRoomScreen(
waitingRoomURL: result.url,
canBack: false, // configure the back behavior
),
),
);
if (token != null) {
// queuing complete
} else {
// queuing cancelled (e.g. user swiped back)
}
break;
default:
break;
}
check expiry time #
final time = await noq.getExpiryTime();
print(time);
extends session #
The duration of the ticket can be extended by utilizing extendSession method on noq object. The parameter is in minutes
final result = await noq.extendSession(60);
print(result);
delete session #
The duration of the ticket can be extended by utilizing extendSession method on noq object. The parameter is in minutes
await noq.deleteSession();
Change language #
The language of the waiting room can be changed.
noq.language = Language.zhHant;
enum Language {
en,
zhHant,
zhHans,
fr,
de,
it,
ja,
es,
ko,
pt,
}
Error #
NoTokenException- if token is not exist, method may throw this error. In order to obtain a token, useenqueueTokenExpiredException- when calling extends session, the token maybe expired already, then this exception will be thrown.