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' #6

Closed
wudaming1 opened this issue Aug 4, 2021 · 6 comments
Closed

type 'Null' is not a subtype of type 'double' #6

wudaming1 opened this issue Aug 4, 2021 · 6 comments

Comments

@wudaming1
Copy link

When the exception was thrown, this was the stack:
#0 TransformerPageController.page (package:flutter_swiper_null_safety/src/transformer_page_view/transformer_page_view.dart:171:9)
#1 _PageIndicatorState._createPainer (package:flutter_swiper_null_safety/src/flutter_page_indicator/flutter_page_indicator.dart:235:40)
#2 _PageIndicatorState.build (package:flutter_swiper_null_safety/src/flutter_page_indicator/flutter_page_indicator.dart:250:18)
#3 StatefulElement.build (package:flutter/src/widgets/framework.dart:4612:27)
#4 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4495:15)

just
Index: lib/src/transformer_page_view/transformer_page_view.dart
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8

--- lib/src/transformer_page_view/transformer_page_view.dart (revision 1365b80)
+++ lib/src/transformer_page_view/transformer_page_view.dart (revision 6f7c83ab0aef1ae40f808b5e2a7d6dd123337f49)
@@ -143,8 +143,8 @@
return renderIndex;
}

  • double? get realPage {
  • return super.page;
  • double get realPage {
  • return super.page ?? 0.0;
    }

static _getRenderPageFromRealPage(
@@ -363,7 +363,7 @@

       double position = 0;
  •      double page = _pageController.realPage ?? 0;
    
  •      double page = _pageController.realPage;
    
         if (_transformer != null && _transformer!.reverse) {
           position = page - index;
    
@lianyagang
Copy link
Owner

When the exception was thrown, this was the stack:
#0 TransformerPageController.page (package:flutter_swiper_null_safety/src/transformer_page_view/transformer_page_view.dart:171:9)
#1 _PageIndicatorState._createPainer (package:flutter_swiper_null_safety/src/flutter_page_indicator/flutter_page_indicator.dart:235:40)
#2 _PageIndicatorState.build (package:flutter_swiper_null_safety/src/flutter_page_indicator/flutter_page_indicator.dart:250:18)
#3 StatefulElement.build (package:flutter/src/widgets/framework.dart:4612:27)
#4 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4495:15)

just

Index: lib/src/transformer_page_view/transformer_page_view.dart
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
--- lib/src/transformer_page_view/transformer_page_view.dart (revision 1365b80)
+++ lib/src/transformer_page_view/transformer_page_view.dart (revision 6f7c83ab0aef1ae40f808b5e2a7d6dd123337f49)
@@ -143,8 +143,8 @@
return renderIndex;
}

  • double? get realPage {

  • return super.page;

  • double get realPage {

  • return super.page ?? 0.0;
    }

static _getRenderPageFromRealPage(
@@ -363,7 +363,7 @@

       double position = 0;
  •      double page = _pageController.realPage ?? 0;
    
  •      double page = _pageController.realPage;
    
         if (_transformer != null && _transformer!.reverse) {
           position = page - index;
    

有没有复现路径?这个错误,看不到什么信息

@wudaming1
Copy link
Author

把你demo里面的ExampleVertical的Swiper加上 loop: false属性就可以复现,你咋回的怎么快?

@lianyagang
Copy link
Owner

把你demo里面的ExampleVertical的Swiper加上 loop: false属性就可以复现,你咋回的怎么快?

最近工作很忙。等我稍微不忙,我处理一下

@eripe970
Copy link

I get similar problem, is there a solution? This returns null for me and causing the same error

  double get page {
    return loop
        ? _getRenderPageFromRealPage(realPage, loop, itemCount, reverse)
        : realPage;
  }

@lianyagang
Copy link
Owner

fix it

@lianyagang
Copy link
Owner

把你demo里面的ExampleVertical的Swiper加上 loop: false属性就可以复现,你咋回的怎么快?

已修复

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