Utility Methods API for PubNub Dart SDK

The methods on this page are utility methods that don't fit into other categories.

Pause

Call the pause() method to force the SDK to stop all requests to PubNub server when there are active subscribe channels.

Method(s)

To pause() the data transmission you can use the following method(s) in Dart SDK.

pause()

This method doesn't take any arguments.

Basic Usage

subscription.pause()

Resume

Call the resume() method to force the SDK to try and reach out PubNub.

Method(s)

To resume() the data transmission you can use the following method(s) in Dart SDK.

resume()

Basic Usage

subscribtion.resume()

This method doesn't take any arguments.

Encrypt File

Encrypts file content in bytes format.

Method(s)

pubnub.files.encryptFileencryptFile(
List<int> bytes,
{CipherKey? cipherKey,
Keyset? keyset,
String? using}
)
ParameterTypeRequiredDescription
bytesList<int>YesFile content in bytes.
cipherKeycipherKeyOptionalA cipherKey to override Keyset.cipherKey. For more information, refer to Configuration.
keysetKeysetOptionalOverride for the PubNub default keyset configuration.
usingStringOptionalKeyset name from the keysetStore to be used for this method call.

Basic Usage

var encryptedFile = pubnub.files
.encryptFile(fileContentBytes, cipherKey: CipherKey.fromUtf8('key'));

Returns

Byte List of encrypted data.

Decrypt File

Decrypts file content in bytes format.

pubnub.files.decryptFile(
List<int> bytes,
{CipherKey? cipherKey,
Keyset? keyset,
String? using})
ParameterTypeRequiredDescription
bytesList<int>YesFile content in bytes.
cipherKeycipherKeyOptionalA cipherKey to override Keyset.cipherKey. For more information, refer to Configuration.
keysetKeysetOptionalOverride for the PubNub default keyset configuration.
usingStringOptionalKeyset name from the keysetStore to be used for this method call.

Basic Usage

var decryptedFile = pubnub.files
.decryptFile(fileContentBytes, cipherKey: CipherKey.fromUtf8('key'));

Returns

Byte list of decrypted data.

Time

This function returns the current timetoken value from the PubNub network.

Algorithm constructing the timetoken
timetoken = (Unix epoch time in seconds) * 10000000

Example of creating a timetoken for a specific time and date:

08/19/2013 @ 9:20pm in UTC = 1376961606
timetoken = 1376961606 * 10000000
timetoken = 13769616060000000

Method(s)

To fetch Time you can use the following method(s) in Dart SDK:

time()

Basic Usage

var response = await pubnub.time();

Returns

The time() operation returns a Timetoken which contains the following operations:

MethodTypeDescription
valueintReturns an int representation of current timetoken.
Last updated on