-
Notifications
You must be signed in to change notification settings - Fork 29.2k
Run pub get post-processing for each package in workspace #170517
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
if (list == null) { | ||
return <String>[]; | ||
} | ||
if (list is! List<Object?>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this function can just be if section
not being present is an error:
if (map case {section: final List<String>? list when map.containsKey(section)) {
return list ?? <String>[];
}
throw FormatException('Expected `$section` to be `List<String>?`, got `${map[section]}');
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When trying that i get: Key expressions in map patterns must be constants.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh that's annoying... Honestly, I'd remove this helper and just use the pattern above in its place with the constant keys. This helper function is doing a lot of unnecessary checks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more thing. When you read json the List doesn't become a List<String>
it is a List<Object?>
, and you need to validate each item separately and cast the list. I don't think that can be done with pattern matching...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This definitely works with pattern matching:
final json = <String, Object?>{
'foo': <String>['bar', 'baz'],
};
final jsonWithNull = <String, Object?>{
'foo': <String?>['bar', 'baz', null],
};
void main() {
if (json case {'foo': final List<String> list}) {
print('Destructured JSON list: $list Runtime type: ${list.runtimeType}');
} else {
print('Failed to destructure $json');
}
if (jsonWithNull case {'foo': final List<String> list}) {
print('Destructured JSON list: $list Runtime type: ${list.runtimeType}');
} else {
print('Failed to destructure $jsonWithNull');
}
if (jsonWithNull case {'foo': final List<String?> list}) {
print('Destructured JSON list: $list Runtime type: ${list.runtimeType}');
} else {
print('Failed to destructure $jsonWithNull');
}
}
Outputs:
Destructured JSON list: [bar, baz] Runtime type: List<String>
Failed to destructure {foo: [bar, baz, null]}
Destructured JSON list: [bar, baz, null] Runtime type: List<String?>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but when you read json, it doesn't type the lists as <String>[]
. but List<dynamic>
(which matches List<Object?>
).
import 'dart:convert';
main() {
switch (jsonDecode('["A", "B", "C"]')) {
case final List<String> a:
print('List of String');
case final List<Object?> a:
print('List of Object');
case final a:
print('Something else ${a.runtimeType}');
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, good point... that's really annoying behavior since map patterns are supposed to be most useful for JSON destructuring...
Anyway, this approach would be less verbose than the current one:
List<String> _parseList(Map<String, Object?> map, String section) {
final Object? result = map[section];
try {
return (result as List<Object?>?)?.cast<String>() ?? <String>[];
} on TypeError {
throw FormatException(
'Expected `$section` to be `List<String>`, got ${result.runtimeType}',
);
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but defer final approval to Ben.
Once we remove |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for humoring me 😅 LGTM!
@bkonyi thanks! Yeah - async code review is tough sometimes. But thanks for being insistent on code quality! |
flutter/flutter@0ab008a...d733bea 2025-06-23 mdebbar@google.com Add `--no-web-resources-cdn` to all web integration tests (flutter/flutter#171013) 2025-06-23 bkonyi@google.com [ Tool ] Roll package:dds 5.0.4 (flutter/flutter#171007) 2025-06-23 jessiewong401@gmail.com Update Docs to Warn Users Edge-To-Edge opt out is being deprecated for Android 16+ (API 36+) (flutter/flutter#170816) 2025-06-23 30870216+gaaclarke@users.noreply.github.com License cpp jun20 (flutter/flutter#170948) 2025-06-23 mdebbar@google.com Un-bringup `Linux web_tool_tests` (flutter/flutter#171004) 2025-06-23 engine-flutter-autoroll@skia.org Roll Packages from 7f41e75 to 02770da (5 revisions) (flutter/flutter#171006) 2025-06-23 engine-flutter-autoroll@skia.org Roll Dart SDK from bb16990911b5 to a09de0d3556c (2 revisions) (flutter/flutter#171000) 2025-06-23 bruno.leroux@gmail.com Reland: Fix InputDecoration.floatingLabelBehavior is not inherited (flutter/flutter#170995) 2025-06-23 engine-flutter-autoroll@skia.org Roll Skia from aef4081157f0 to 0311837abe86 (1 revision) (flutter/flutter#170992) 2025-06-23 sigurdm@google.com Run pub get post-processing for each package in workspace (flutter/flutter#170517) 2025-06-23 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Fix InputDecoration.floatingLabelBehavior is not inherited (#170905)" (flutter/flutter#170994) 2025-06-23 bruno.leroux@gmail.com Fix InputDecoration.floatingLabelBehavior is not inherited (flutter/flutter#170905) 2025-06-23 engine-flutter-autoroll@skia.org Roll Skia from fcd1c55da9cc to aef4081157f0 (1 revision) (flutter/flutter#170990) 2025-06-22 robert.ancell@canonical.com Clear background in the GTK layer, instead of OpenGL (flutter/flutter#170840) 2025-06-22 robert.ancell@canonical.com Show window on first frame on Linux (flutter/flutter#170844) 2025-06-22 engine-flutter-autoroll@skia.org Roll Dart SDK from 98db1db5ff65 to bb16990911b5 (1 revision) (flutter/flutter#170988) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC muhatashim@google.com,stuartmorgan@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…r#9478) flutter/flutter@0ab008a...d733bea 2025-06-23 mdebbar@google.com Add `--no-web-resources-cdn` to all web integration tests (flutter/flutter#171013) 2025-06-23 bkonyi@google.com [ Tool ] Roll package:dds 5.0.4 (flutter/flutter#171007) 2025-06-23 jessiewong401@gmail.com Update Docs to Warn Users Edge-To-Edge opt out is being deprecated for Android 16+ (API 36+) (flutter/flutter#170816) 2025-06-23 30870216+gaaclarke@users.noreply.github.com License cpp jun20 (flutter/flutter#170948) 2025-06-23 mdebbar@google.com Un-bringup `Linux web_tool_tests` (flutter/flutter#171004) 2025-06-23 engine-flutter-autoroll@skia.org Roll Packages from 7f41e75 to 02770da (5 revisions) (flutter/flutter#171006) 2025-06-23 engine-flutter-autoroll@skia.org Roll Dart SDK from bb16990911b5 to a09de0d3556c (2 revisions) (flutter/flutter#171000) 2025-06-23 bruno.leroux@gmail.com Reland: Fix InputDecoration.floatingLabelBehavior is not inherited (flutter/flutter#170995) 2025-06-23 engine-flutter-autoroll@skia.org Roll Skia from aef4081157f0 to 0311837abe86 (1 revision) (flutter/flutter#170992) 2025-06-23 sigurdm@google.com Run pub get post-processing for each package in workspace (flutter/flutter#170517) 2025-06-23 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Fix InputDecoration.floatingLabelBehavior is not inherited (#170905)" (flutter/flutter#170994) 2025-06-23 bruno.leroux@gmail.com Fix InputDecoration.floatingLabelBehavior is not inherited (flutter/flutter#170905) 2025-06-23 engine-flutter-autoroll@skia.org Roll Skia from fcd1c55da9cc to aef4081157f0 (1 revision) (flutter/flutter#170990) 2025-06-22 robert.ancell@canonical.com Clear background in the GTK layer, instead of OpenGL (flutter/flutter#170840) 2025-06-22 robert.ancell@canonical.com Show window on first frame on Linux (flutter/flutter#170844) 2025-06-22 engine-flutter-autoroll@skia.org Roll Dart SDK from 98db1db5ff65 to bb16990911b5 (1 revision) (flutter/flutter#170988) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC muhatashim@google.com,stuartmorgan@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…r#9478) flutter/flutter@0ab008a...d733bea 2025-06-23 mdebbar@google.com Add `--no-web-resources-cdn` to all web integration tests (flutter/flutter#171013) 2025-06-23 bkonyi@google.com [ Tool ] Roll package:dds 5.0.4 (flutter/flutter#171007) 2025-06-23 jessiewong401@gmail.com Update Docs to Warn Users Edge-To-Edge opt out is being deprecated for Android 16+ (API 36+) (flutter/flutter#170816) 2025-06-23 30870216+gaaclarke@users.noreply.github.com License cpp jun20 (flutter/flutter#170948) 2025-06-23 mdebbar@google.com Un-bringup `Linux web_tool_tests` (flutter/flutter#171004) 2025-06-23 engine-flutter-autoroll@skia.org Roll Packages from 7f41e75 to 02770da (5 revisions) (flutter/flutter#171006) 2025-06-23 engine-flutter-autoroll@skia.org Roll Dart SDK from bb16990911b5 to a09de0d3556c (2 revisions) (flutter/flutter#171000) 2025-06-23 bruno.leroux@gmail.com Reland: Fix InputDecoration.floatingLabelBehavior is not inherited (flutter/flutter#170995) 2025-06-23 engine-flutter-autoroll@skia.org Roll Skia from aef4081157f0 to 0311837abe86 (1 revision) (flutter/flutter#170992) 2025-06-23 sigurdm@google.com Run pub get post-processing for each package in workspace (flutter/flutter#170517) 2025-06-23 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Fix InputDecoration.floatingLabelBehavior is not inherited (#170905)" (flutter/flutter#170994) 2025-06-23 bruno.leroux@gmail.com Fix InputDecoration.floatingLabelBehavior is not inherited (flutter/flutter#170905) 2025-06-23 engine-flutter-autoroll@skia.org Roll Skia from fcd1c55da9cc to aef4081157f0 (1 revision) (flutter/flutter#170990) 2025-06-22 robert.ancell@canonical.com Clear background in the GTK layer, instead of OpenGL (flutter/flutter#170840) 2025-06-22 robert.ancell@canonical.com Show window on first frame on Linux (flutter/flutter#170844) 2025-06-22 engine-flutter-autoroll@skia.org Roll Dart SDK from 98db1db5ff65 to bb16990911b5 (1 revision) (flutter/flutter#170988) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC muhatashim@google.com,stuartmorgan@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Fixes #161927