TransWikia.com

How to fix "This requires the spread-collection experiment to be enable " on latest upgrade of flutter?

Stack Overflow Asked by Nitneuq on December 30, 2021

Hello I have a code like this

SizedBox(height: 10),
        ..._function(context, model),
        SizedBox(height: 5),
        if (model.bloc)
)

But after flutter upgrade I have error focus on "…"

This requires the spread-collection experiment to be enable

How can I rewrite this correctly ? Thank you

2 Answers

In pubspec.yaml

change environment sdk constraints to:

  sdk: ">=2.7.0 <3.0.0"

Invalidate Caches and Restart your IDE

Android Studio: File>> Invalidate Caches and Restart.

That would be enough.

Answered by Jagraj Singh on December 30, 2021

What happens when you change your environment to this:

environment:
  sdk: ">=2.6.0 <3.0.0"

and also do a Flutter clean and restart the IDE

Edited:

In the root of your project create a file named analysis_options.yaml and add these lines to it:

analyzer:
  enable-experiment:
    - spread-collections

Answered by P4yam on December 30, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP