flutter_deep_link_guard 1.0.0
flutter_deep_link_guard: ^1.0.0 copied to clipboard
Declarative route middleware and deep link security guard wrapper for GoRouter in Flutter.
flutter_deep_link_guard #
Declarative route middleware and deep link security guard wrapper for GoRouter in Flutter.
🌟 Key Features #
- 🛡️ Declarative Guard Middleware: Chain multiple route access guards (
AuthGuard,RoleGuard, custom policies). - 🔗 Deep Link Security Validator: Validates incoming URL schemes, domain whitelist hosts, and query parameters before routing.
- ⚡ GoRouter Compatible: Drop-in integration into
GoRouterredirect pipeline.
📦 Installation #
Add flutter_deep_link_guard to your pubspec.yaml:
dependencies:
flutter_deep_link_guard: ^1.0.0
🚀 Quick Start #
import 'package:flutter_deep_link_guard/flutter_deep_link_guard.dart';
final pipeline = GuardPipeline([
AuthGuard(
isAuthenticated: () => AuthService.isLoggedIn,
fallbackRedirectPath: '/login',
),
]);
// In GoRouter redirect
redirect: (context, state) async {
return await pipeline.evaluate(GuardContext(
location: state.matchedLocation,
queryParameters: state.uri.queryParameters,
));
}
📄 License #
MIT License - Developed with ❤️ by Olamilekan Adeyemi (@lekthedeveloper).