-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
Steps to Reproduce
a lots of flutter syntax error/compile error come out after we upgrade Flutter from 1.5.4 to 1.7.8, and all the root causes are breaking changes between the latest two stable versions.
for example
in 1.5.4, we wrote codes like this
ImageStream imageStream = imageProvider.resolve(configuration);
void listener(ImageInfo imageInfo, _) {
textImages[index] = imageInfo;
imageStream.removeListener(listener);
}
imageStream.addListener(listener);but in 1.7.8, it can not work until we change it to the code below:
ImageStream imageStream = imageProvider.resolve(configuration);
// we have to declare first,then assign in the second line,
// otherwise removeListener will report can't be referenced before it is declared.
ImageStreamListener listener;
listener = ImageStreamListener((ImageInfo imageInfo, bool synchronousCall) {
textImages[index] = imageInfo;
imageStream.removeListener(listener);
});
imageStream.addListener(listener);we have to declare listener first,then assign in the second line. I don't think it is a regular way to write dart code.
more important, we have so much plugins that are using imageStream addListener/removeListener api. so we have to upgrade all the plugins before we run our top-level app code to avoid compile error, which is very annoying.
Flutter team Really Really Really should consider introducing and using something like the Java's annotation @deprecated(maybe exist already in dart, but it doesn't matter) to make the upgrade process more comfortable.