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

type 'Null' is not a subtype of type 'double' in type cast #172

Open
offical-waqas-khurshid opened this issue Mar 11, 2024 · 3 comments
Open

Comments

@offical-waqas-khurshid
Copy link

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... (package:minimal/main_advanced.dart:53:32)
#2 ConditionalRouteWidget.build (package:minimal/utils/conditional_route_widget.dart:26:21)
#3 StatelessElement.build (package:flutter/src/widgets/framework.dart:5550:49)
#4 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5480:15)
#5 Element.rebuild (package:flutter/src/widgets/framework.dart:5196:7)
#6 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:5462:5)
#7 ComponentElement.mount (package:flutter/src/widgets/framework.dart:5456:5)
... Normal element mounting (182 frames)
#189 Element.inflateWidget (package:flutter/src/widgets/framework.dart:4335:16)
#190 MultiChildRenderObjectElement.inflateWidget (package:flutter/src/widgets/framework.dart:6893:36)
#191 MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6905:32)
... Normal element mounting (492 frames)
#683 Element.inflateWidget (package:flutter/src/widgets/framework.dart:4335:16)
#684 Element.updateChild (package:flutter/src/widgets/framework.dart:3846:18)
#685 _RawViewElement._updateChild (package:flutter/src/widgets/view.dart:291:16)
#686 _RawViewElement.mount (package:flutter/src/widgets/view.dart:314:5)
... Normal element mounting (7 frames)
#693 Element.inflateWidget (package:flutter/src/widgets/framework.dart:4335:16)
#694 Element.updateChild (package:flutter/src/widgets/framework.dart:3846:18)
#695 RootElement._rebuild (package:flutter/src/widgets/binding.dart:1354:16)
#696 RootElement.mount (package:flutter/src/widgets/binding.dart:1323:5)
#697 RootWidget.attach. (package:flutter/src/widgets/binding.dart:1276:18)
#698 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2844:19)
#699 RootWidget.attach (package:flutter/src/widgets/binding.dart:1275:13)
#700 WidgetsBinding.attachToBuildOwner (package:flutter/src/widgets/binding.dart:1088:27)
#701 WidgetsBinding.attachRootWidget (package:flutter/src/widgets/binding.dart:1070:5)
#702 WidgetsBinding.scheduleAttachRootWidget. (package:flutter/src/widgets/binding.dart:1056:7)
#706 _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)
(elided 3 frames from class _Timer and dart:async-patch)

@EkjyotSandhu12
Copy link

Yes facing the same issue
Right now i am using 1.1.1. Just to hide the error

@pstemporowski
Copy link

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.

@EkjyotSandhu12
Copy link

    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,
      ),
    );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants