-
Notifications
You must be signed in to change notification settings - Fork 5
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
Maximum stack exceed when running on WEB....(runned your example code in web) #1
Comments
Ok, really weird. I haven't tested it on the web, though. Will do that soon as let you know. |
I'm seeing the same thing. I narrowed it down somewhat, accessing Line 476 in ebc26f3
I tried cutting out much of the Themed class out and narrowing it down more but haven't been able to yet. Another issue that I am seeing here in the value getter Line 458 in ebc26f3
|
A little more investigation points to extending |
Could this be related? |
Could you please tell me if this is fixed in version 2.1.0? |
@marcglasberg - It's working for me (I ran into the same issue). Nice work! I'm really enjoying this library. |
@marcglasberg The default toString method on Color relies on value to print its string, accessing it indirectly from within ColorRef's value getter by printing triggered a recursive set of calls to value. I did override toString for ColorRef just to not be hit by something similar if I did some quick print() debugging later on. @override
int get value {
// trying to print calls Color.toString which throws the maximum stack exceeded error,
// because Color's default toString method tries to access value which then recursively calls print / value print / value to
// infinity.
print(this);
Color? result = _currentTheme[this] as Color?;
result ??= _defaultTheme[this] as Color?;
result ??= defaultColor;
if (result == null) throw ConstThemeException('Theme color "$id" is not defined.');
if (_transformColor != null) result = _transformColor!(result);
return result.value;
} Maybe you could add a toString method to the ColorRef class? Right now printing a ColorRef or calling toString is going to tell you that you have a Color(0x..) class and not a ColorRef. @override
String toString() {
return "ColorRef('$defaultColor', id: '$id' )";
} |
@nullrocket Thanks for the idea. Please see version 2.2.0: Improved |
The following JSRangeError was thrown building MyApp(dirty):
Invalid argument: Maximum call stack size exceeded
The relevant error-causing widget was
MyApp
lib/main.dart:30
When the exception was thrown, this was the stack
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 829:8 get
The text was updated successfully, but these errors were encountered: