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 7 : BeamerParser({this.onParse}); 8 : 9 : /// Used to inspect and/or modify the parsed [RouteInformation] 10 : /// before returning it for [BeamerDelegate] to use. 11 : final RouteInformation Function(RouteInformation)? onParse; 12 : 13 7 : @override 14 : SynchronousFuture<RouteInformation> parseRouteInformation( 15 : RouteInformation routeInformation) => 16 7 : SynchronousFuture( 17 7 : onParse?.call(routeInformation) ?? routeInformation, 18 : ); 19 : 20 7 : @override 21 : RouteInformation restoreRouteInformation(RouteInformation configuration) => 22 : configuration; 23 : }