phive

Core runtime package for PHive.

Use this package to define model annotations, hook pipelines, and consumer APIs.

What you get

  • @PHiveType and @PHiveField
  • PTypeAdapter<T> runtime support
  • PHiveCtx and PHiveHook
  • PHiveActionException
  • PHiveConsumer<T> with adapter support

Install

dependencies:
	hive_ce: ^2.19.3
	phive: ^0.0.1

If you are in this monorepo:

dependencies:
	phive:
		path: ../phive

Quick Start

import 'package:phive/phive.dart';

@PHiveType(1)
class Session {
	@PHiveField(0)
	final String id;

	@PHiveField(1)
	final String token;

	const Session({required this.id, required this.token});
}

Then run your generator package (phive_generator) with build_runner.

PHiveConsumer quick use

final consumer = PHiveConsumer<Session>('app_sessions');

await consumer.put('current', const Session(id: '1', token: 'abc'));
final session = await consumer.get('current');

Notes

  • This package is runtime-only.
  • For ready-made hooks (TTL/encryption), also add phive_barrel.

Libraries

phive