-
Notifications
You must be signed in to change notification settings - Fork 13
Open

Description
I get this error sometimes
Null check operator used on a null value
The relevant error-causing widget was
Swiper
lib/views/cards_view.dart:36
When the exception was thrown, this was the stack
#0 _StackViewState._updateValues
package:flutter_card_swipper/src/swiper.dart:864
#1 _StackViewState.didUpdateWidget
package:flutter_card_swipper/src/swiper.dart:874
#2 StatefulElement.update
package:flutter/…/widgets/framework.dart:4682
#3 Element.updateChild
package:flutter/…/widgets/framework.dart:3293
#4 ComponentElement.performRebuild
package:flutter/…/widgets/framework.dart:4520
This is the offending function, I suppose _swiperWidth
is null
:
void _updateValues() {
if (widget.scrollDirection == Axis.horizontal) {
final double space = (_swiperWidth! - widget.itemWidth!) / 2;
offsets = [-space, -space / 3 * 2, -space / 3, 0.0, _swiperWidth];
} else {
final double space = (_swiperHeight! - widget.itemHeight!) / 2;
offsets = [-space, -space / 3 * 2, -space / 3, 0.0, _swiperHeight];
}
}
flutter doctor -v
[✓] Flutter (Channel stable, 2.0.6, on macOS 11.2.3 20D91 darwin-x64, locale en-GB)
• Flutter version 2.0.6 at /Users/dennis/flutter
• Framework revision 1d9032c7e1 (3 weeks ago), 2021-04-29 17:37:58 -0700
• Engine revision 05e680e202
• Dart version 2.12.3
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at /Users/dennis/Library/Android/sdk
• Platform android-30, build-tools 30.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.5, Build version 12E262
• CocoaPods version 1.10.1
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 4.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
[✓] Connected device (4 available)
• iPhone 8 Plus (mobile) • 16007D4D-626C-4001-8AAA-D2FE317EE7E7 • ios • com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator)
• iPhone 11 (mobile) • 200809FD-F24E-44C7-8886-05EFF2DD3CDA • ios • com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator)
• macOS (desktop) • macos • darwin-x64 • macOS 11.2.3 20D91 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 90.0.4430.212
amondnet
Metadata
Metadata
Assignees
Labels
No labels