noq 1.1.1 copy "noq: ^1.1.1" to clipboard
noq: ^1.1.1 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 result = await noq.getExpiryTime();
print(result.deadline); // deadline of the ticket
print(result.timeLeftInSeconds); // time left of the ticket
  • timeLeftInSeconds is calculated server-side and may be affected by network latency. It is recommended to exercise caution when the value is below 30 seconds, as it may not be fully accurate.”

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 unix timestamp 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, use enqueue
  • TokenExpiredException - when calling extends session, the token maybe expired already, then this exception will be thrown.
0
likes
100
points
62
downloads

Publisher

verified publishernoq.hk

Weekly Downloads

NoQ SDK for Flutter application.

Documentation

API reference

License

unknown (license)

Dependencies

dio, flutter, jwt_decode, shared_preferences, webview_flutter

More

Packages that depend on noq