PubNub LogoDocs
SupportContact SalesLoginTry Our APIs

›API Reference

dart

  • Getting Started
  • API Reference

    • Configuration
    • Publish & Subscribe
    • Presence
    • Access Manager
    • Channel Groups
    • Message Persistence
    • Mobile Push
    • Objects
    • Files
    • Message Actions
    • Miscellaneous
  • Troubleshooting
  • Change Log
  • Feature Support
  • Platform Support

Utility Methods API for PubNub Dart SDK

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

Decrypt File

Description

Decrypts file content in bytes format.

pubnub.files.decryptFile(List<int> bytes,
  {CipherKey? cipherKey,
  Keyset? keyset,
  String? using})
ParameterTypeRequiredDescription
bytesListYesFile 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.

Encrypt File

Description

Encrypts file content in bytes format.

Method(s)

pubnub.files.encryptFileencryptFile(
  List<int> bytes,
  {CipherKey? cipherKey,
  Keyset? keyset,
  String? using}
)
ParameterTypeRequiredDescription
bytesListYesFile 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.

Time

Description

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

The timetoken is constructed using the following algorithm:
timetoken = (Unix epoch time in seconds) * 10000000

For example:

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.
← Message ActionsTroubleshooting →
  • Decrypt File
    • Description
    • Basic Usage
    • Returns
  • Encrypt File
    • Description
    • Method(s)
    • Basic Usage
    • Returns
  • Time
    • Description
    • Method(s)
    • Basic Usage
    • Returns
© PubNub Inc. - Privacy Policy