flutter: enable contructor-tearoffs not working

Viewed 193

Hello i'm having this line of code in flutter

StreamController<LocationModel> locationController = StreamController<LocationModel>.broadcast;

but i'm having erros below: This requires the 'constructor-tearoffs' language feature to be enabled. Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14.0 or higher, and running 'pub get'.dart(ex

I already update my pubspec.ymal to 2.14.0 but this error still not solved. any help please.

1 Answers

You don't need any experimental compiler feature, you need to add braces at the end:

StreamController<LocationModel> locationController = 
                       StreamController<LocationModel>.broadcast(); // <==
Related