titan_atlas 0.0.1
titan_atlas: ^0.0.1 copied to clipboard
Atlas — Titan's routing & navigation system. Declarative, type-safe, zero-boilerplate page management with Passages, Sentinels, and deep linking.
Atlas #
Titan's routing & navigation system — declarative, zero-boilerplate, high-performance page management for Flutter.
Part of the Titan ecosystem.
The Atlas Lexicon #
| Concept | Titan Name | Purpose |
|---|---|---|
| Router | Atlas | Maps all paths, bears the world |
| Route | Passage | A way through to a destination |
| Shell Route | Sanctum | Inner chamber — persistent layout |
| Route Guard | Sentinel | Protects passage |
| Redirect | Drift | Navigation shifts course |
| Parameters | Runes | Ancient symbols carrying meaning |
| Transition | Shift | Change of form/phase |
| Route State | Waypoint | Current position in the journey |
Quick Start #
dependencies:
titan_atlas: ^0.0.1
import 'package:titan_atlas/titan_atlas.dart';
final atlas = Atlas(
passages: [
Passage('/', (_) => const HomeScreen()),
Passage('/profile/:id', (wp) => ProfileScreen(id: wp.runes['id']!)),
],
);
void main() => runApp(
MaterialApp.router(routerConfig: atlas.config),
);
That's it. No code generation. No boilerplate.
Features #
Passages — Route Definitions #
// Static
Passage('/home', (_) => HomeScreen())
// Dynamic (Runes)
Passage('/user/:id', (wp) => UserScreen(id: wp.runes['id']!))
// Wildcard
Passage('/files/*', (wp) => FileViewer(path: wp.remaining!))
// Named
Passage('/settings', (_) => SettingsScreen(), name: 'settings')
// With transition
Passage('/modal', (_) => ModalScreen(), shift: Shift.slideUp())
Navigation #
// Static API
Atlas.to('/profile/42');
Atlas.to('/search?q=dart');
Atlas.to('/detail', extra: myData);
Atlas.toNamed('profile', runes: {'id': '42'});
Atlas.replace('/home');
Atlas.back();
Atlas.backTo('/home');
Atlas.reset('/login');
// Context extension
context.atlas.to('/profile/42');
context.atlas.back();
Sanctum — Shell Routes #
Sanctum(
shell: (child) => Scaffold(
body: child,
bottomNavigationBar: const AppNavBar(),
),
passages: [
Passage('/home', (_) => HomeScreen()),
Passage('/search', (_) => SearchScreen()),
],
)
Sentinel — Route Guards #
// Guard all routes
Sentinel((path, _) => isLoggedIn ? null : '/login')
// Guard specific paths
Sentinel.only(paths: {'/admin'}, guard: (_, __) => '/login')
// Exclude public paths
Sentinel.except(paths: {'/login', '/'}, guard: (_, __) => '/login')
// Async guard
Sentinel.async((path, _) async {
final ok = await checkPermission(path);
return ok ? null : '/403';
})
Shift — Transitions #
Shift.fade() // Fade in/out
Shift.slide() // Slide from right
Shift.slideUp() // Slide from bottom
Shift.scale() // Scale + fade
Shift.none() // Instant
Shift.custom(builder: ...) // Your own
Drift — Redirects #
Atlas(
drift: (path, _) {
if (path == '/old') return '/new';
return null;
},
passages: [...],
)
Performance #
Atlas uses a trie-based route matcher for O(k) path resolution where k is the number of path segments — matching time is independent of total route count.
Works with Titan State #
void main() {
final atlas = Atlas(passages: [...]);
runApp(
Beacon(
pillars: [AuthPillar.new],
child: MaterialApp.router(routerConfig: atlas.config),
),
);
}
Packages #
| Package | Description |
|---|---|
titan |
Core reactive engine |
titan_bastion |
Flutter widgets (Vestige, Beacon) |
titan_atlas |
Routing & navigation (this package) |
License #
MIT — Ikolvi