Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: Not a constant expression: unexpected kernel tag InvalidExpression (19) #39

Closed
Denmal1982 opened this issue Dec 22, 2018 · 10 comments

Comments

@Denmal1982
Copy link

Version of flutter_calendar_carousel

flutter_calendar_carousel: ^1.3.3

body:
import 'package:flutter_calendar_carousel/flutter_calendar_carousel.dart' show CalendarCarousel;
Container(
child: CalendarCarousel()
)

I/flutter (24871): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter (24871): The following _CompileTimeError was thrown building MainWidget(dirty, state:
I/flutter (24871): _MainWidgetState#8c468):
I/flutter (24871): 'package:flutter_calendar_carousel/flutter_calendar_carousel.dart': error: Not a constant
I/flutter (24871): expression: unexpected kernel tag InvalidExpression (19)
I/flutter (24871):
I/flutter (24871): When the exception was thrown, this was the stack:
I/flutter (24871): #0 _MainWidgetState.build (file:///D:/android/projects/polnayazapis/lib/main.dart:36:18)
I/flutter (24871): #1 StatefulElement.build (package:flutter/src/widgets/framework.dart:3766:27)
I/flutter (24871): #2 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3678:15)
I/flutter (24871): #3 Element.rebuild (package:flutter/src/widgets/framework.dart:3531:5)
I/flutter (24871): #4 StatefulElement.update (package:flutter/src/widgets/framework.dart:3835:5)
I/flutter (24871): #5 Element.updateChild (package:flutter/src/widgets/framework.dart:2729:15)
I/flutter (24871): #6 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:4803:14)
I/flutter (24871): #7 Element.updateChild (package:flutter/src/widgets/framework.dart:2729:15)
I/flutter (24871): #8 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3689:16)
I/flutter (24871): #9 Element.rebuild (package:flutter/src/widgets/framework.dart:3531:5)

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel beta, v0.9.4, on Microsoft Windows [Version 10.0.17134.472], locale ru-RU)
[√] Android toolchain - develop for Android devices (Android SDK 28.0.3)
[√] Android Studio (version 3.2)
[√] Connected devices (1 available)

@atnegrete
Copy link

The same thing is happening to me. Must be a new bug? I noticed the last PR in was 2 days ago though

@hyochan
Copy link
Member

hyochan commented Dec 23, 2018

Could you test the exmaple project and comeback? I can't see any fixes just reading this.

@atnegrete
Copy link

I cloned the project & I had to update all the double assignments using integers to double, essentially adding '.0'

@Denmal1982
Copy link
Author

I cloned the project & I had to update all the double assignments using integers to double, essentially adding '.0'

it works, thanks

@hyochan
Copy link
Member

hyochan commented Dec 23, 2018

Which variable is it?

@atnegrete
Copy link

atnegrete commented Dec 23, 2018

in example\lib\main.dart replaced borderRadius: BorderRadius.all(Radius.circular(1000)) with borderRadius: BorderRadius.all(Radius.circular(1000.0))

in lib\flutter_calendar_carousel.dart

added import 'dart:async'; to use the Future class.

this.markedDateIconMargin = 5, this.markedDateIconOffset = 5,

to
this.markedDateIconMargin = 5.0, this.markedDateIconOffset = 5.0,

and lastly

Positioned(
                bottom: 0,
                right: 0,
                child: Container(
                  padding: EdgeInsets.all(3),
                  decoration: widget.markedDateMoreCustomDecoration == null
                      ? new BoxDecoration(
                    color: Colors.red,
                    borderRadius: BorderRadius.all(Radius.circular(1000)),
                  )
                      : widget.markedDateMoreCustomDecoration
                  ,
                  child: Center(
                    child: Text(
                      widget.markedDateMoreShowTotal ? (count + widget.markedDateIconMaxShown).toString() : (count.toString() + '+'),
                      style: widget.markedDateMoreCustomTextStyle == null
                          ? TextStyle(
                          fontSize: 9,
                          color: Colors.white,
                          fontWeight: FontWeight.normal
                      )
                          : widget.markedDateMoreCustomTextStyle
                      ,
                    ),
                  ),
                ),
              )

to

 Positioned(
                bottom: 0.0,
                right: 0.0,
                child: Container(
                  padding: EdgeInsets.all(3.0),
                  decoration: widget.markedDateMoreCustomDecoration == null
                      ? new BoxDecoration(
                    color: Colors.red,
                    borderRadius: BorderRadius.all(Radius.circular(1000.0)),
                  )
                      : widget.markedDateMoreCustomDecoration
                  ,
                  child: Center(
                    child: Text(
                      widget.markedDateMoreShowTotal ? (count + widget.markedDateIconMaxShown).toString() : (count.toString() + '+'),
                      style: widget.markedDateMoreCustomTextStyle == null
                          ? TextStyle(
                          fontSize: 9.0,
                          color: Colors.white,
                          fontWeight: FontWeight.normal
                      )
                          : widget.markedDateMoreCustomTextStyle
                      ,
                    ),
                  ),
                ),
              )

@hyochan
Copy link
Member

hyochan commented Jan 15, 2019

Is this still occurring in a recent version which is 1.3.7?

@atnegrete
Copy link

I was on vacation. I will take a look at it tonight. Thanks for the update!

@atnegrete
Copy link

Yes, it is still occurring.

@hyochan
Copy link
Member

hyochan commented Jan 19, 2019

Thank you for the fix. I hope you can give us PR next time.
This is very strange that it didn't catch type error in plugins environment.

Hope you to confirm this in 1.3.8.

@hyochan hyochan mentioned this issue Jan 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants