enqueue static method

Future<String> enqueue(
  1. JsonMap payload, {
  2. String? type,
  3. String? idempotencyKey,
})

Enqueues a custom payload for offline-first delivery.

Implementation

static Future<String> enqueue(
  JsonMap payload, {
  String? type,
  String? idempotencyKey,
}) async {
  final result = await LocusChannels.methods.invokeMethod('enqueue', {
    'payload': payload,
    if (type != null) 'type': type,
    if (idempotencyKey != null) 'idempotencyKey': idempotencyKey,
  });
  if (result is String && result.isNotEmpty) {
    return result;
  }
  throw PlatformException(
    code: 'ENQUEUE_FAILED',
    message: 'Native enqueue did not return an id',
    details: result,
  );
}