isExactlyScope method Null safety

bool isExactlyScope(
  1. AuthScope scope
)

Whether or not two scopes are exactly the same.

Implementation

bool isExactlyScope(AuthScope scope) {
  final incomingIterator = scope._segments.iterator;
  for (var segment in _segments) {
    /// the scope has less segments so no match.
    if (!incomingIterator.moveNext()) {
      return false;
    }

    final incomingSegment = incomingIterator.current;

    if (incomingSegment.name != segment.name ||
        incomingSegment.modifier != segment.modifier) {
      return false;
    }
  }

  return true;
}