Line data Source code
1 : import 'package:flutter/foundation.dart'; 2 : import 'package:flutter/widgets.dart'; 3 : 4 : /// Parses [RouteInformation] into a type that [BeamerDelegate] will understand, 5 : /// which is again [RouteInformation]. 6 : class BeamerParser extends RouteInformationParser<RouteInformation> { 7 : /// Creates a [BeamerParser] with specified properties. 8 8 : BeamerParser({this.onParse}); 9 : 10 : /// Used to inspect and/or modify the parsed [RouteInformation] 11 : /// before returning it for [BeamerDelegate] to use. 12 : final RouteInformation Function(RouteInformation)? onParse; 13 : 14 7 : @override 15 : SynchronousFuture<RouteInformation> parseRouteInformation( 16 : RouteInformation routeInformation) => 17 7 : SynchronousFuture( 18 7 : onParse?.call(routeInformation) ?? routeInformation, 19 : ); 20 : 21 7 : @override 22 : RouteInformation restoreRouteInformation(RouteInformation configuration) => 23 : configuration; 24 : }