isFlutterCreateScaffold static method

bool isFlutterCreateScaffold(
  1. String source
)

Returns true when source contains at least 3 of the 4 default Flutter counter-app markers, indicating the file is an unmodified (or minimally modified) flutter create scaffold.

Markers are matched via String.contains — comments containing a marker string also count toward the threshold. This is an accepted limitation; the heuristic favors silent overwrite for the common case over false negatives on hand-authored files.

@param source The full source text of main.dart to inspect. @return true when the match count is >= 3, false otherwise.

Implementation

static bool isFlutterCreateScaffold(String source) {
  var count = 0;
  for (final marker in _markers) {
    if (source.contains(marker)) count++;
  }
  return count >= 3;
}