File tree Expand file tree Collapse file tree
packages/core-dart/lib/src/routing Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import 'result.dart' ;
2+
3+ /// Immutable result object returned from routing resolution.
4+ ///
5+ /// Holds the [source] tag indicating how the route was resolved,
6+ /// an optional numeric [id] extracted from the address or memo,
7+ /// and any [warnings] emitted during resolution.
8+ final class RoutingResult {
9+ final RoutingSource source;
10+ final BigInt ? id;
11+ final List <RoutingWarning > warnings;
12+
13+ RoutingResult ({
14+ required this .source,
15+ this .id,
16+ List <RoutingWarning >? warnings,
17+ }) : warnings = List .unmodifiable (warnings ?? const []);
18+
19+ @override
20+ String toString () =>
21+ 'RoutingResult(source: $source , id: $id , warnings: $warnings )' ;
22+
23+ @override
24+ bool operator == (Object other) =>
25+ identical (this , other) ||
26+ other is RoutingResult &&
27+ source == other.source &&
28+ id == other.id &&
29+ _listEquals (warnings, other.warnings);
30+
31+ @override
32+ int get hashCode => Object .hash (source, id, Object .hashAll (warnings));
33+
34+ static bool _listEquals (List <RoutingWarning > a, List <RoutingWarning > b) {
35+ if (a.length != b.length) return false ;
36+ for (var i = 0 ; i < a.length; i++ ) {
37+ if (a[i] != b[i]) return false ;
38+ }
39+ return true ;
40+ }
41+ }
You can’t perform that action at this time.
0 commit comments