from static method

MutUri from(
  1. dynamic from
)

Implementation

static MutUri from(dynamic from) {
  if (from == null) {
    return MutUri();
  }
  if (from is String) {
    from = Uri.parse(from);
  }
  if (from is Uri) {
    if (from.isScheme('http') || from.isScheme('https')) {
      return MutUri(
        origin: from.origin,
        paths: from.pathSegments,
        query: from.queryParameters,
      );
    } else {
      return MutUri(
        paths: from.pathSegments,
        query: from.queryParameters,
      );
    }
  }
  if (from is MutUri) {
    return from;
  }
  throw Exception('');
}