koukibadr / Elegant-Notification

https://pub.dev/packages/elegant_notification
MIT License
46 stars 30 forks source link

Build error toast_content.dart:137 #95

Closed dpalmeira closed 7 months ago

dpalmeira commented 1 year ago

Hello, first of all thank you for your work, it's great!

My issue: When I try to import the latest lib version on my project "elegant_notification 1.11.0" it fails at build time with the following error:

: Error: Cannot invoke a non-'const' constructor where a const expression is expected. toast_content.dart:137 Try using a constructor or factory that is 'const'. child: const Column( ^^^^^^ Target kernel_snapshot failed: Exception

FAILURE: Build failed with an exception.

                  : const EdgeInsets.only(
                      top: verticalComponentPadding,
                      right: horizontalComponentPadding,
                    ),

Line 137 --> child: const Column( mainAxisAlignment: MainAxisAlignment.start, children: [ Icon(

So, if I try the previous version "elegant_notification: 1.10.1" then it works perfectly, at build time and also by using it, showing the messages as expected.

I don't if it is caused by my app, or it's in fact a bug.

Thank you so much for your help and time.

arslancb commented 1 year ago

Bump

BobQuasius commented 1 year ago

Still busted. This package worked great a few months ago but now I get errors. I tried old versions, I tried the new versions -- all give me this. I just took this const out of my file and it works fine now.

const error const line 137

hashtagEsen commented 1 year ago

I have the same issue.

../../../.pub-cache/hosted/pub.dev/elegant_notification-1.11.0/lib/widgets/toast_content.dart:137:32: Error: Cannot invoke a non-'const' constructor where a const expression is expected. Try using a constructor or factory that is 'const'. child: const Column( ^^^^^^ ../../../.pub-cache/hosted/pub.dev/elegant_notification-1.11.0/lib/widgets/toast_content.dart:137:32: Error: Cannot invoke a non-'const' constructor where a const expression is expected. Try using a constructor or factory that is 'const'. child: const Column( ^^^^^^ Restarted application in 496ms.

Solution: I downgraded to version 1.10.1 and then it works. The new version 1.11.0 seems to have a bug.

koukibadr commented 1 year ago

A new version has been published fixing this issue https://pub.dev/packages/elegant_notification

koukibadr commented 8 months ago

@dpalmeira feel free to close this issue

dpalmeira commented 7 months ago

Hello @koukibadr it works now!

A comment: I have also to make a small change to jump from 1.10.1 to 1.12.0 caused by "notificationPosition will no longer set the alert position instead use position with Alignment type".

Thank you so much for your help and great work.