Files
sdk/pkg/analyzer/lib/source
Sam Rawlins 105efd85b6 [analyzer] Add a valueOrThrow extension similar to our oft-used typeOrThrow
This really helps in complying with strict-casts. YamlNode.value returns
a `dynamic`, which is then often passed somewhere which accepts Object
(and then does some type tests). To avoid the implicit cast from
`dynamic`, we can use `.valueOrThrow` (or basically just
`.value as Object`).

The extension getter improves readability and avoids a lot of
as-expressions inside conditional expressions etc.

Change-Id: I50d2eebd51d6fc3eccf1c930652dd5ce70dd9eb1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/277582
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2023-01-03 18:53:39 +00:00
..