Skip to content

[pubspec_parse] Add platforms field to Pubspec - #2566

Merged
kevmoo merged 5 commits into
dart-lang:mainfrom
spydon:pubspec-parse-platforms
Oct 19, 2026
Merged

kevmoo merged 5 commits into
dart-lang:mainfrom
spydon:pubspec-parse-platforms

Conversation

@spydon

@spydon spydon commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor

Adds the platforms field to Pubspec, see https://dart.dev/tools/pub/pubspec#platforms.

The field is parsed as a Map<String, dynamic>?, mirroring how the flutter section is exposed, since the pubspec format declares platforms as a map with null values (android:, ios:, and so on). It is included in Pubspec.toJson and covered by parsing, error, lenient, and round-trip tests.

Follow-up to #2565. Each new field is in its own PR to keep them easy to review.

@spydon
spydon requested a review from a team August 29, 2026 16:05

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for the platforms field in the Pubspec class of the pubspec_parse package. This includes adding the field to the model, updating the generated JSON serialization logic, updating the package version and changelog to 1.7.0-wip, and adding corresponding unit tests for parsing and serialization. There are no review comments, and I have no additional feedback to provide.

@kevmoo
kevmoo requested review from a team, kevmoo, liamappelbe and srawlins as code owners October 19, 2026 17:39
Comment thread pkgs/pubspec_parse/lib/src/pubspec.dart Outdated
/// `web` and `windows`. Values are currently always `null`.
///
/// See https://dart.dev/tools/pub/pubspec#platforms.
final Map<String, dynamic>? platforms;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use Object? instead of dynamic, so that you have to check what value you have, instead of blindly asking anything.

@kevmoo
kevmoo merged commit 462d92b into dart-lang:main Oct 19, 2026
24 of 25 checks passed
copybara-service Bot pushed a commit to dart-lang/sdk that referenced this pull request Oct 20, 2026
tools (https://github.com/dart-lang/tools/compare/f6c7a2d..4d7715a):
  4d7715ac  Mon Oct 19 16:09:30 2026 -0700  Kevin Moore  Replace `@dart-lang/dart-bat` with `@dart-lang/dart-ecosystem-team` in `CODEOWNERS` (dart-lang/tools#2697)
  a22c558c  Tue Oct 20 06:56:10 2026 +0900  YeungKC  [markdown] Check the first character before inline syntax regexes (dart-lang/tools#2695)
  c57bde49  Mon Oct 19 14:40:39 2026 -0700  dart-ecosystem-bot[bot]  [boring] Update BoringSSL to 64188f17 (dart-lang/tools#2692)
  7a4ea6f8  Tue Oct 20 00:09:47 2026 +0300  Hasan Armoush  [pubspec_parse] Expose version constraint on PathDependency (dart-lang/tools#2581)
  85e03753  Mon Oct 19 22:41:32 2026 +0200  Lukas Klingsbo  [pubspec_parse] Add hooks field to Pubspec (dart-lang/tools#2568)
  13139ec6  Mon Oct 19 22:28:47 2026 +0200  Lukas Klingsbo  [pubspec_parse] Add false_secrets field to Pubspec (dart-lang/tools#2567)
  462d92bf  Mon Oct 19 21:56:25 2026 +0200  Lukas Klingsbo  [pubspec_parse] Add platforms field to Pubspec (dart-lang/tools#2566)

TEST=ci

Change-Id: I106b05a08a7395f72e01a86a952abd41f4630831
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/566840
Commit-Queue: Kevin Moore <kevmoo@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants