ResponsiveFramework
ResponsiveFramework copied to clipboard
type 'Null' is not a subtype of type 'double' in type cast
The following _TypeError was thrown building ConditionalRouteWidget(dirty, dependencies: [InheritedResponsiveBreakpoints, _ModalScopeStatus]): type 'Null' is not a subtype of type 'double' in type cast
The relevant error-causing widget was:
ConditionalRouteWidget ConditionalRouteWidget:file:///C:/Users/waqas.khursheed/Desktop/FlutterMinimalWebsite/lib/main_advanced.dart:41:18
When the exception was thrown, this was the stack:
#0 new ResponsiveValue (package:responsive_framework/src/responsive_value.dart:47:61)
#1 MyApp.build.
Yes facing the same issue Right now i am using 1.1.1. Just to hide the error
To ensure all scenarios are accounted for, including the one in the example where 'mobile' is specified along with two values, it would be necessary to set a default value. This adjustment will help cover cases that the current condition in your case misses.
return ResponsiveScaledBox(
width: ResponsiveValue<double>(
context,
conditionalValues: [
//Scale:- the application will scale and maintain ratio of designScreenWidth pixels in any resolution by scaling.
Condition.largerThan(
breakpoint: 0,
value: ThemeConstants.designScreenWidth,
),
],
defaultValue: 0, // <-- ADD THIS
).value,
child: ClampingScrollWrapper.builder(
dragWithMouse: true,
context,
child,
),
);
This was a tough call with a long history and limitations of Dart's type capabilities. Making it non-nullable broke usages that require nullable values.
What's remaining is the confusion between typed null
This was a tough call with a long history and limitations of Dart's type capabilities.
Making it non-nullable broke usages that require nullable values.
What's remaining is the confusion between typed null
/ <double?> non-nullable and the value's nullability. Any suggestions?
Hi, same problem here, any suggestions? Thank you for your great job!