bool isRelative(String uri)

Returns true if uri contains a relative path.

A path is relative when, if it gets resolved by a different path, remains on the same scheme and server.

Examples of relative uris:

  • document
  • /document
  • #fragment

Examples of non-relative paths:

  • http://example.com
  • //example.com

Source

static bool isRelative(String uri) =>
    _testUri1.resolve(uri).toString().startsWith(_test1) &&
    _testUri2.resolve(uri).toString().startsWith(_test2);