Unverified Commit 98077617 authored by fzyzcjy's avatar fzyzcjy Committed by GitHub

Tiny improvement of RouteSettings display (#114481)

* impl

* Update packages/flutter/lib/src/widgets/navigator.dart
Co-authored-by: 's avatarchunhtai <47866232+chunhtai@users.noreply.github.com>

* Update navigator_test.dart
Co-authored-by: 's avatarchunhtai <47866232+chunhtai@users.noreply.github.com>
parent 45939170
......@@ -548,7 +548,7 @@ class RouteSettings {
final Object? arguments;
@override
String toString() => '${objectRuntimeType(this, 'RouteSettings')}("$name", $arguments)';
String toString() => '${objectRuntimeType(this, 'RouteSettings')}(${name == null ? 'none' : '"$name"'}, $arguments)';
}
/// Describes the configuration of a [Route].
......
......@@ -3935,6 +3935,16 @@ void main() {
);
expect(policy, isA<ReadingOrderTraversalPolicy>());
});
group('RouteSettings.toString', () {
test('when name is not null, should have double quote', () {
expect(const RouteSettings(name: '/home').toString(), 'RouteSettings("/home", null)');
});
test('when name is null, should not have double quote', () {
expect(const RouteSettings().toString(), 'RouteSettings(none, null)');
});
});
}
typedef AnnouncementCallBack = void Function(Route<dynamic>?);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment