isBeginningMatch method

Safety<bool> isBeginningMatch(
  1. Route match
)

開始が match と同じなら true を返す.

Implementation

Safety<bool> isBeginningMatch(Route match) {

    final log = Log(classLocation: runtimeType, functionLocation: 'isBeginningMatch');

    // 1. まずは長さを比較し this.route が route 以上かを検証する
    if (length < match.length) return Safety(false, log);

    int index = 0;

    for (final i in match) {

        // 1 より 必ず return
        if (i != elementAt(index)) return Safety(false, log);

        index = index + 1;

    }

    return Safety(true, log);

}