isWithin method

bool isWithin (String parent, 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;