-
Notifications
You must be signed in to change notification settings - Fork 717
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
As the language and ecosystem has grown the target for static safety has moved up. Previously it was considered enough to be explicit about the places where `dynamic` is introduced, and then it is OK to silently do dynamic things with it, and write code that keeps references `dynamic` throughout. It is more common today to want to be explicit about places where `dynamic` is used, not just where it is introduced. We can see this in expanded use of stricter static checking and the `avoid_dynamic_calls` lint. Rephrase two guidelines to move towards being strict about using dynamic. - Recommend annotating with `Object?` instead of `dynamic` when inferences fails. Update the code sample to use `Object?` in the method arguments are return types for the JSON related API. Update the text to explain how `Object?` is treated differently and more strictly statically, which makes the unsafe operations visible in syntax. - Rephrase from using dynamic to "disable static checking" to using it to "invoke dynamic members". The wording for the rule already focused on using dynamic to "permit all operations". Remove the paragraph about retaining the `dynamic` type when working with APIs that use it, instead recommending to move away from `dynamic` at those boundaries and using `Object?` in most code.
- Loading branch information
Showing
3 changed files
with
35 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters