-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Customer-reported issue with NNBD migration tool #44345
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
Comments
I see three tests failing: 'Where Test'This fails with:
Changing: final subscription = listenable
.where(((x) => x.isEven) as bool Function(int))
.listen((x, _) => destValues.add(x)); to final subscription =
listenable.where((x) => x.isEven).listen((x, _) => destValues.add(x)); seems to resolve this. 'mergeWith Test'This fails with:
As described on https://api.dart.dev/stable/2.10.4/dart-core/LateInitializationError-class.html, this is thrown when
Looking at the stacktrack, looks like the failure is in the call to @override
void removeListener(VoidCallback listener) {
super.removeListener(listener);
if (!hasListeners) {
previousInChain.removeListener(internalHandler);
}
} I don't fully understand the code, but should that if test be unnegated (i.e. if 'Debounce Test'The error is:
Looking at your version before null safety, you had: debounceTimer?.cancel();
debounceTimer =
Timer(debounceDuration, () => value = previousInChain.value);
}; And now: debounceTimer.cancel();
debounceTimer =
Timer(debounceDuration, () => value = previousInChain.value); It looks like we call |
@mit-mit I figured out what happens to the debounce and the mergeWidth test. it makes sense. But in case of the whereTest, this cast was added by the migration tool. And the combineTest doesn't even compile anymore since I ran the migration. |
@stereotype441 can you comment on this concrete migration question in final listenable = ValueNotifier<int>(0);
final destValues = <int>[];
final subscription =
listenable.where((x) => x.isEven).listen((x, _) => destValues.add(x)); The migration tool suggests: final subscription =
listenable.where(((x) => x.isEven) as bool Function(int)).listen((x, _) => destValues.add(x)); Which causes:
|
@mit-mit please also have a look at the combine Test which does not compile anymore after the migration |
That one looks similar; the tool suggests: final subscription = listenable1
.combineLatest<String , StringIntWrapper >(
listenable2, ((i, s) => StringIntWrapper(s, i)) as StringIntWrapper Function(int, String))
.listen((x, _) {
destValues.add(x);
}); |
This is a bug in the migration tool. It was fixed in e047dd6. |
As of 1c7fe71, the null safety migration tool has been removed from active development and retired. No further work on the tool is planned. If you still need help, or you believe this issue has been closed in error, please feel free to reopen. |
Hi,
I'm stuck while trying to port my package functional_listener to NNB.
you can find the curenty state here:
https://github.com/escamoteur/functional_listener/tree/null-safety
Working with the tool was fine, but now not all tests work and even compile anymore what they did before.
The tool again added some strange down casts on lambda functions.
I have no idea why the `debounceTest' doesn't work anymore.
some of the tests threw
late initialization errors
Please have a look at it and tell me what to do. The code is easy to overview.
dart --version
)Dart SDK version: 2.12.0-76.0.dev (dev) (Wed Nov 25 05:22:28 2020 -0800) on "windows_x64"
The text was updated successfully, but these errors were encountered: