go method

void go(
  1. String location, {
  2. Map<String, dynamic> pathParams = const <String, dynamic>{},
  3. Map<String, dynamic> queryParams = const <String, dynamic>{},
  4. Map<String, dynamic> params = const <String, dynamic>{},
})

Navigate to a location.

Implementation

void go(
  String location, {
  Map<String, dynamic> pathParams = const <String, dynamic>{},
  Map<String, dynamic> queryParams = const <String, dynamic>{},
  Map<String, dynamic> params = const <String, dynamic>{},
}) {
  Map<String, dynamic> args = <String, dynamic>{};
  if (pathParams.isNotEmpty) args.addAll(pathParams);
  if (queryParams.isNotEmpty) args.addAll(queryParams);
  if (params.isNotEmpty) args.addAll(params);
  routing.args = args;
  pathParams.forEach((key, value) {
    if (location.contains(":$key")) {
      location = location.replaceAll(":$key", value.toString());
    }
  });
  queryParams.forEach((key, value) {
    location = "$location${location.contains("?") ? "&" : "?"}$key=$value";
  });
  global().go(location, extra: params);
}