titan_bastion 0.1.0 copy "titan_bastion: ^0.1.0" to clipboard
titan_bastion: ^0.1.0 copied to clipboard

Flutter widgets for Titan state management. Vestige, Beacon, and auto-tracking reactive UI with Pillar architecture.

Titan Bastion #

The Bastion — where Titan's power meets the screen

Vestige, Beacon, and auto-tracking reactive UI — powered by the Pillar architecture.

pub package License: MIT Flutter


Quick Start #

flutter pub add titan_bastion

Or see the latest version on pub.dev.

1. Define a Pillar #

import 'package:titan_bastion/titan_bastion.dart';

class CounterPillar extends Pillar {
  late final count = core(0);
  late final doubled = derived(() => count.value * 2);

  void increment() => strike(() => count.value++);
}

2. Provide via Beacon #

void main() => runApp(
  Beacon(
    pillars: [CounterPillar.new],
    child: const MyApp(),
  ),
);

3. Consume via Vestige #

Vestige<CounterPillar>(
  builder: (context, counter) => Text('${counter.count.value}'),
)

Auto-tracking. Only rebuilds when read Cores change. No selectors needed.


Widgets #

Widget Description
Vestige<P> Auto-tracking consumer — rebuilds only when read Cores change
Beacon Scoped Pillar provider — creates, initializes, and auto-disposes
Confluence2/3/4 Multi-Pillar consumer widget
Lens In-app debug panel

Vestige — Auto-Tracking Consumer #

// Reads count.value → rebuilds only when count changes
Vestige<CounterPillar>(
  builder: (context, c) => Text('${c.count.value}'),
)

// Reads doubled.value → rebuilds only when doubled changes
Vestige<CounterPillar>(
  builder: (context, c) => Text('${c.doubled.value}'),
)

Beacon — Scoped Provider #

// Single Pillar
Beacon(
  pillars: [CounterPillar.new],
  child: const CounterScreen(),
)

// Multiple Pillars
Beacon(
  pillars: [
    CounterPillar.new,
    AuthPillar.new,
    CartPillar.new,
  ],
  child: const MyApp(),
)

// Feature-scoped (auto-disposes when widget unmounts)
Navigator.push(context, MaterialPageRoute(
  builder: (_) => Beacon(
    pillars: [CheckoutPillar.new],
    child: const CheckoutScreen(),
  ),
));

Confluence — Multi-Pillar Consumer #

Confluence2<AuthPillar, CartPillar>(
  builder: (context, auth, cart) => Text(
    '${auth.user.value?.name}: ${cart.itemCount.value} items',
  ),
)

Typed variants: Confluence2, Confluence3, Confluence4. Same auto-tracking as Vestige.

Lens — Debug Overlay #

Lens(
  enabled: kDebugMode,
  child: MaterialApp(home: MyApp()),
)

Shows real-time Pillar registrations, Herald events, Vigil errors, and Chronicle logs. Toggle with Lens.show(), Lens.hide(), Lens.toggle().

Context Extension #

// Access Pillar from context
final counter = context.pillar<CounterPillar>();
counter.increment();

Lifecycle #

Beacon handles the full lifecycle:

  1. Creates Pillar instances via factory functions
  2. Initializes — calls onInit() for setup, watchers, subscriptions
  3. Provides — makes Pillars available to descendants
  4. Disposes — calls onDispose() and cleans up all Cores when widget unmounts

Complete Example #

import 'package:flutter/material.dart';
import 'package:titan_bastion/titan_bastion.dart';

class CounterPillar extends Pillar {
  late final count = core(0);
  late final doubled = derived(() => count.value * 2);
  void increment() => strike(() => count.value++);
}

void main() => runApp(
  Beacon(
    pillars: [CounterPillar.new],
    child: MaterialApp(
      home: Scaffold(
        body: Center(
          child: Vestige<CounterPillar>(
            builder: (context, c) => Column(
              mainAxisSize: MainAxisSize.min,
              children: [
                Text('Count: ${c.count.value}', style: const TextStyle(fontSize: 48)),
                Text('Doubled: ${c.doubled.value}'),
              ],
            ),
          ),
        ),
        floatingActionButton: Builder(builder: (context) {
          final c = context.pillar<CounterPillar>();
          return FloatingActionButton(
            onPressed: c.increment,
            child: const Icon(Icons.add),
          );
        }),
      ),
    ),
  ),
);

Packages #

Package Description
titan Core reactive engine — pure Dart
titan_bastion Flutter widgets (this package)
titan_atlas Routing & navigation (Atlas)

Documentation #

Guide Link
Introduction 01-introduction.md
Getting Started 02-getting-started.md
Core Concepts 03-core-concepts.md
Pillars 04-stores.md
Flutter Integration 05-flutter-integration.md
Oracle & Observation 06-middleware.md
Testing 07-testing.md
Advanced Patterns 08-advanced-patterns.md
API Reference 09-api-reference.md
Migration Guide 10-migration-guide.md
Architecture 11-architecture.md
Atlas Routing 12-atlas-routing.md
Chronicles of Titan Story-driven tutorial
Chapter IX: The Scroll Inscribes Form management with Scroll
Chapter X: The Codex Opens Pagination with Codex
Chapter XI: The Quarry Yields Data fetching with Quarry
Chapter XII: The Confluence Converges Multi-Pillar consumer
Chapter XIII: The Lens Reveals Debug overlay

License #

MIT — Ikolvi

1
likes
0
points
337
downloads

Publisher

verified publisherikolvi.com

Weekly Downloads

Flutter widgets for Titan state management. Vestige, Beacon, and auto-tracking reactive UI with Pillar architecture.

Homepage
Repository (GitHub)
View/report issues

Topics

#state-management #flutter #reactive #widget #signals

License

unknown (license)

Dependencies

flutter, titan

More

Packages that depend on titan_bastion