mirror of
https://github.com/flutter/packages.git
synced 2025-06-07 11:59:30 +08:00
[tool] Update to Dart 3 (#6030)
Updates the repo tooling to Dart 3, now that the N-2 version has Dart 3, which allows us to use Dart 3 features (e.g., records) going forward. To allow the update: - Removes `break` commands from `switch`es (all done automatically with `dart fix --apply`) - Replaces mocking of `ProcessResult` with just creating an actual `ProcessResult` since it's a `final` data class and thus can't (but also doesn't need to be) mocked.
This commit is contained in:
@ -138,20 +138,15 @@ class UpdateExcerptsCommand extends PackageLoopingCommand {
|
||||
switch (extension) {
|
||||
case '':
|
||||
language = 'txt';
|
||||
break;
|
||||
case '.kt':
|
||||
language = 'kotlin';
|
||||
break;
|
||||
case '.cc':
|
||||
case '.cpp':
|
||||
language = 'c++';
|
||||
break;
|
||||
case '.m':
|
||||
language = 'objectivec';
|
||||
break;
|
||||
case '.gradle':
|
||||
language = 'groovy';
|
||||
break;
|
||||
default:
|
||||
language = extension.substring(1);
|
||||
break;
|
||||
@ -173,7 +168,6 @@ class UpdateExcerptsCommand extends PackageLoopingCommand {
|
||||
}
|
||||
}
|
||||
output.writeln(line);
|
||||
break;
|
||||
case _ExcerptParseMode.pragma:
|
||||
if (!line.startsWith('```')) {
|
||||
errors.add(
|
||||
@ -195,7 +189,6 @@ class UpdateExcerptsCommand extends PackageLoopingCommand {
|
||||
mode = _ExcerptParseMode.injecting;
|
||||
}
|
||||
output.writeln(line);
|
||||
break;
|
||||
case _ExcerptParseMode.injecting:
|
||||
if (line == '```') {
|
||||
if (existingBlock.toString() != excerpt) {
|
||||
@ -210,7 +203,6 @@ class UpdateExcerptsCommand extends PackageLoopingCommand {
|
||||
} else {
|
||||
existingBlock.writeln(line);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (detectedChange) {
|
||||
@ -250,23 +242,18 @@ class UpdateExcerptsCommand extends PackageLoopingCommand {
|
||||
case 'objectivec':
|
||||
case 'swift':
|
||||
prefix = '// ';
|
||||
break;
|
||||
case 'css':
|
||||
prefix = '/* ';
|
||||
suffix = ' */';
|
||||
break;
|
||||
case 'html':
|
||||
case 'xml':
|
||||
prefix = '<!--';
|
||||
suffix = '-->';
|
||||
padding = ' ';
|
||||
break;
|
||||
case 'yaml':
|
||||
prefix = '# ';
|
||||
break;
|
||||
case 'sh':
|
||||
prefix = '# ';
|
||||
break;
|
||||
}
|
||||
final String startRegionMarker = '$prefix#docregion $section$suffix';
|
||||
final String endRegionMarker = '$prefix#enddocregion $section$suffix';
|
||||
|
Reference in New Issue
Block a user