Documentation Framework & Component Library
🎯 Learning Objective
Master the reusable UI component architecture, dynamic layout engine, upgraded code block features, and state evolution timelines powering the Transwave Riverpod Documentation platform.
📋 Prerequisites
- Basic HTML5 semantic elements and CSS flexbox/grid layout principles.
- Basic understanding of modern Flutter state management requirements.
1. Comprehensive Callout System (9 Reusable Variants)
To emphasize key architectural trade-offs, pitfalls, and docs recommendations, 9 specialized callouts are provided:
Riverpod 3 compile-time safety prevents ProviderNotFoundException errors completely at build time.
Always use ref.watch() inside widget build() methods to subscribe to reactive state changes automatically.
Never call ref.read() inside a widget's build() method. Doing so bypasses reactive rebuilds.
Mutating state on an unmounted Riverpod Notifier after an async await boundary triggers runtime crashes. Always check if (!ref.mounted) return;.
Enforce 100% code generation using @riverpod annotations across all features to reduce boilerplate and guarantee type inference.
In map_items_provider.dart, spatial bounding box checks in SpatialCacheEnvelope eliminate 92% of redundant map viewport REST calls during active panning.
Remi Rousselet recommends Notifier and AsyncNotifier for all new state holders, superseding legacy StateNotifier and StateProvider.
Passing custom filter objects to dynamic Family providers without overriding operator == and hashCode causes infinite fetch loops.
Use ref.watch(provider.select((s) => s.property)) to scope widget rebuilds exclusively to targeted state fields.
2. Upgraded Code Component Experience
The code component supports line numbers, syntax highlighting, copy-to-clipboard, highlighted lines, diff blocks, and expandable containers:
Highlighted Lines Example (Lines 5 & 8-9)
@riverpod
class CurrentUserNotifier extends _$CurrentUserNotifier {
@override
Future<User> build() async {
final repo = ref.watch(authRepositoryProvider); // Line 5: Highlighted
return repo.fetchCurrentUser();
}
Future<void> refresh() async { // Line 8: Highlighted
if (!ref.mounted) return; // Line 9: Highlighted
state = const AsyncValue.loading();
}
}
Code Diff Component (+ Added / - Removed)
- final userProvider = StateNotifierProvider<UserNotifier, User>((ref) => UserNotifier());
+ @riverpod
+ class UserNotifier extends _$UserNotifier {
+ @override
+ User build() => const User.anonymous();
+ }
3. 5-Step Comparison Flow Component
Every architectural comparison follows this structured 5-step evaluation card:
AsyncNotifier in CurrentUserNotifier to combine network fetching with local in-memory mutation (updateLocationLocal).@riverpod class Notifiers for state that requires both initial fetching and operational mutations.StreamProvider or legacy StateNotifierProvider.AsyncNotifier provides rich state control at the cost of class boilerplate.AsyncNotifier whenever the state requires user action mutations after initial fetch.4. Visual Decision Tree Component
Visually select the right Riverpod provider type based on requirements:
AsyncNotifierProvider with full AsyncValue handling.NotifierProvider or pure Provider.5. State Management Evolution Timeline
Understanding Riverpod requires tracing how Flutter state management evolved over time:
ProviderNotFoundException; cannot combine providers easily.Notifier and AsyncNotifier primitives.6. Interactive UI Components
Tab Group Component
Modern Riverpod 3 syntax uses @riverpod annotations:
@riverpod class MyNotifier extends _$MyNotifier { ... }
Legacy Riverpod 1 syntax required manual providers:
final myProvider = StateNotifierProvider<MyNotifier, State>((ref) => MyNotifier());
Accordions with Global Controls
layout-engine.js automatically hydrates the header, sidebar, reading time, and floating Table of Contents dynamically for every chapter page!
The engine scans the page for all H2 and H3 heading elements and builds an auto-linked sidebar with an IntersectionObserver scroll-spy!
Click-to-Reveal Spoiler Component
Commandment #9: All API prices in Transwave are transmitted as integer EUR cents! Never transmit floating point values across backend endpoints.
Interactive Knowledge Quiz Card
🎉 Framework Polish Complete
The documentation platform now includes dynamic layout hydration, floating TOC scroll-spy, 9 specialized callouts, 5-step comparison cards, visual decision trees, state evolution timelines, expandable code diffs, and accessible interactive components.