Skip to content

Commit

Permalink
Parameters getList support defaultValue
Browse files Browse the repository at this point in the history
  • Loading branch information
lwj1994 committed Aug 7, 2024
1 parent 961283c commit 6b62933
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions auto_route/lib/src/common/parameters.dart
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ class Parameters {
}

/// returns the value corresponding with [key] as nullable [List<String>]
List<String> getList(String key) {
var val = _params[key];
List<String> getList(String key, [List<String>? defaultValue]) {
var val = _params[key] ?? defaultValue;
if (val == null) {
throw MissingRequiredParameterError(
'Failed to parse [List<String>] $key value from ${_params[key]}');
Expand Down

0 comments on commit 6b62933

Please sign in to comment.