noq 1.0.7
noq: ^1.0.7 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, and optional seconds can be supplied too.
The result is unixtimestamp in seconds
final result = await noq.extendSession(0, second: 10);
print(result);
delete session #
To delete a valid session. After deletion, the session is no longer valid.
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.