Migrate dartdoc to null safety#84153
Migrate dartdoc to null safety#84153fluttergithubbot merged 1 commit intoflutter:masterfrom anisalibegic:master
Conversation
|
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat. If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
| assert(path.extension(file.path) == '.html'); | ||
| final Iterable<String> matches = _pattern.allMatches(file.readAsStringSync()) | ||
| .map((RegExpMatch m ) => m.group(0)); | ||
| .map((RegExpMatch m ) => m.group(0)!); |
There was a problem hiding this comment.
are we sure m.group(0) cannot be null?
There was a problem hiding this comment.
I believe, group(0) should always be non-null since it is the entire match of the pattern [1] and allMatches above only returns matches.
[1] https://master-api.flutter.dev/flutter/dart-core/Match/group.html
There was a problem hiding this comment.
As @goderbauer mentioned, using group(0) while iterating through all matches makes no harm since it won't iterate if there are no matches.. and if there are then it will return an entire match (which must exist) making it safe to use null assertion operator.
| assert(path.extension(file.path) == '.html'); | ||
| final Iterable<String> matches = _pattern.allMatches(file.readAsStringSync()) | ||
| .map((RegExpMatch m ) => m.group(0)); | ||
| .map((RegExpMatch m ) => m.group(0)!); |
There was a problem hiding this comment.
I believe, group(0) should always be non-null since it is the entire match of the pattern [1] and allMatches above only returns matches.
[1] https://master-api.flutter.dev/flutter/dart-core/Match/group.html
Part of #84014.