Skip to content

Commit

Permalink
Pass a Dart language version to the Dart formatter.
Browse files Browse the repository at this point in the history
This will be required in an upcoming version of the Dart formatter.

PiperOrigin-RevId: 673452282
  • Loading branch information
srawlins authored and copybara-github committed Sep 11, 2024
1 parent d7a8334 commit 2259e10
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* Require Dart >= 3.3.0.
* Require analyzer 6.4.1.
* Add support for extension types.
* Require dart_style >= 2.3.7, so that the current Dart language version can be
passed to `DartFormatter`.

## 5.4.4

Expand Down
4 changes: 3 additions & 1 deletion lib/src/builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ class MockBuilder implements Builder {
// The source lib may be pre-null-safety because of an explicit opt-out
// (`// @dart=2.9`), as opposed to living in a pre-null-safety package. To
// allow for this situation, we must also add an opt-out comment here.
final mockLibraryContent = DartFormatter().format('''
final mockLibraryContent =
DartFormatter(languageVersion: DartFormatter.latestLanguageVersion)
.format('''
// Mocks generated by Mockito $packageVersion from annotations
// in ${entryLib.definingCompilationUnit.source.uri.path}.
// Do not manually edit this file.
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dependencies:
build: ^2.0.0
code_builder: ^4.5.0
collection: ^1.15.0
dart_style: ^2.0.0
dart_style: ^2.3.7
matcher: ^0.12.15
meta: ^1.3.0
path: ^1.8.0
Expand Down

0 comments on commit 2259e10

Please sign in to comment.