1

My Flutter android app was running without any problems but I upgraded Flutter to 3.3.4 and now I am having the following Error while building app bundle (and apk). Please help me.

The argument type 'EdgeInsets' can't be assigned to the parameter type 'Margins?'.

Code:

style: {
                    'body': Style(
                      margin: EdgeInsets.zero,
                      padding: EdgeInsets.zero,
                      fontSize: const FontSize(16.0),
                      lineHeight: const LineHeight(1.4),
                      color: Colors.white,
                      textAlign: TextAlign.center,
                      fontWeight: FontWeight.bold,
                    ),
                    'figure': Style(
                        margin: EdgeInsets.zero, padding: EdgeInsets.zero),
                  },

Error

and another error:

Error: Cannot invoke a non-'const' constructor where a const expression is expected. Try using a constructor or factory that is 'const'.

                    fontSize: const FontSize(12.0),
                                    ^^^^^^^^

Another Error

2
  • It's not because you're upgrading flutter version, please put your code where the error consists Commented Oct 17, 2022 at 5:24
  • style: { 'body': Style( margin: EdgeInsets.zero, padding: EdgeInsets.zero, fontSize: const FontSize(16.0), lineHeight: const LineHeight(1.4), color: Colors.white, textAlign: TextAlign.center, fontWeight: FontWeight.bold, ), 'figure': Style( margin: EdgeInsets.zero, padding: EdgeInsets.zero), }, Commented Oct 17, 2022 at 8:07

1 Answer 1

1

Replace fontSize: const FontSize(12.0) with fontSize: 12

Post the saved_articles_tile.dart snippet for more help.

Sign up to request clarification or add additional context in comments.

2 Comments

style: { 'body': Style( margin: EdgeInsets.zero, padding: EdgeInsets.zero, fontSize: const FontSize(16.0), lineHeight: const LineHeight(1.4), color: Colors.white, textAlign: TextAlign.center, fontWeight: FontWeight.bold, ), 'figure': Style( margin: EdgeInsets.zero, padding: EdgeInsets.zero), },
What is the exact widget you are using?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.