hasTrailer function

bool hasTrailer(
  1. String message, {
  2. String token = kDefaultTrailerToken,
})

Whether message carries the git trailer token (Refs: <value>) with a non-blank value — the INVERTED-tracking half of the policy.

Implementation

bool hasTrailer(String message, {String token = kDefaultTrailerToken}) =>
    RegExp(
      '^${RegExp.escape(token)}:[ \\t]*\\S',
      multiLine: true,
    ).hasMatch(message);