Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

update for null safety #145

Merged
merged 3 commits into from
Nov 9, 2020
Merged

update for null safety #145

merged 3 commits into from
Nov 9, 2020

Conversation

devoncarew
Copy link
Contributor

  • update to support 2.12.0 and null safety

@devoncarew devoncarew requested a review from pq November 7, 2020 01:41
@google-cla google-cla bot added the cla: yes Google CLA signed label Nov 7, 2020
Copy link
Contributor

@pq pq left a comment

Choose a reason for hiding this comment

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

I feel like I'm just figuring this out as I go... Hope I'm not just muddying the waters with all the questions!


Analytics getAnalytics() {
Analytics? getAnalytics() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like Analytics is sure to be non-null?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point - done.

}

return _analytics;
}

void _handleFoo() {
var analytics = getAnalytics();
var analytics = getAnalytics()!;
Copy link
Contributor

Choose a reason for hiding this comment

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

In which case this bang can go away?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup - removed.

int drops;
int _lastReplenish;
late int drops;
late int _lastReplenish;

ThrottlingBucket(this.startingCount) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider assigning drops in an initializer list. Then you can drop the late modifier?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 - yup, this works

lib/src/usage_impl_io.dart Show resolved Hide resolved
lib/src/usage_impl_io.dart Show resolved Hide resolved

@override
void operator []=(String key, dynamic value) {
if (value == null && !_map.containsKey(key)) return;
if (_map[key] == value) return;
if (value == null && !_map!.containsKey(key)) return;
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd be inclined to mark _map late so you can drop all of these bangs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

pubspec.yaml Outdated

dependencies:
path: ^1.4.0
path: ^1.8.0-nullsafety.3
Copy link
Contributor

Choose a reason for hiding this comment

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

Curious: why the .3 lower bound?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was just the latest available - I can drop to 1.8.0-nullsafety.

@devoncarew devoncarew marked this pull request as ready for review November 7, 2020 08:48
@devoncarew
Copy link
Contributor Author

Thanks for the review! Updated with the latest - ptal.

Copy link
Contributor

@pq pq left a comment

Choose a reason for hiding this comment

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

👍

@devoncarew devoncarew merged commit 62d73d9 into master Nov 9, 2020
@devoncarew devoncarew deleted the prep_for_nnbd branch March 17, 2021 19:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes Google CLA signed
Development

Successfully merging this pull request may close these issues.

2 participants