isWithin method

bool isWithin(
  1. String parent,
  2. String child
)

Returns true if child is a path beneath parent, and false otherwise.

path.isWithin('/root/path', '/root/path/a'); // -> true
path.isWithin('/root/path', '/root/other'); // -> false
path.isWithin('/root/path', '/root/path'); // -> false

Implementation

bool isWithin(String parent, String child) =>
    _isWithinOrEquals(parent, child) == _PathRelation.within;