After upgrading to flutter 3.0 it seems that the IterableExtension and the IterableIterableExtension of the collections.dart official API doc do not work anymore. Do you have to import a package manually to continue using them?
I'm particularly interested in flattened property of the IterableIterableExtension and in the sortedBy of the IterableExtension
The correct answer was given by @jamesdlin as a comment below the question. I'm just reposting it as an answer, so nobody misses the solution when skimming over this question.
We experienced the same, but couldn't find a quick solution to this. I'm posting my error message here, so it can be found using search engines:
"error: The method 'whereNot' isn't defined for the type 'List'."
Solution is:
I am not sure how it was used before, but there seems to be a package for collection (@immadisairaj)
Are you using
import 'package:collection/collection.dart';
(@jamesdlin)Prior to 3.0 it was exported by flutter or some of my other imports. That is no longer the case and I need to import it explicitly. (@gbaccetta)
If you haven't already: You should also add the package to your pubspec.yaml file, see this linter rule.
We use the freezed package and this is the only package that has a dependency on the collection package mentioned above. Probably changes between version 1.1.1 and version 2.1.0+1 of the package changed something (They do mention breaking changes, even though it was not clear to me, that this error was coming from the dependency upgrade.)
Btw: It was not clear to me, that the collection package has to be imported and is a pub.dev hosted package, as its docs can be found on official flutter sites.