staticPop static method

Future staticPop(
  1. HHPayloadI payload
)

Gets and deletes a value in one operation. Returns the value before deletion.

Implementation

static Future<dynamic> staticPop(HHPayloadI payload) async {
  final ctx = HHCtx(payload);
  return await ctx.control.emit(
    TriggerType.onDelete.name,
    action: (ctx) async {
      final value = await ctx.access.storePop(ctx.payload.key!);
      if ((ctx as HHCtx).config.usesMeta) {
        await ctx.access.metaPop(ctx.payload.key!);
      }
      return value;
    },
    handleCtrlException: true,
  );
}