Skip to content
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

bug(null-safety): LateInitializationError: Local firstIndex has not been initialized. #151

Closed
cpboyd opened this issue Jan 24, 2021 · 1 comment

Comments

@cpboyd
Copy link

cpboyd commented Jan 24, 2021

If neither the if nor else if triggers to initialize the firstIndex, then this code will fail as it remains uninitialized:

late final int firstIndex;
late final int lastIndex;
if (_childElements.isEmpty) {
firstIndex = 0;
lastIndex = 0;
} else if (_didUnderflow) {
firstIndex = _childElements.firstKey()!;
lastIndex = _childElements.lastKey()! + 1;
}
for (int index = firstIndex; index <= lastIndex; ++index) {

@cpboyd
Copy link
Author

cpboyd commented Mar 5, 2021

The fix was merged

@cpboyd cpboyd closed this as completed Mar 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant