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

Banner #1

Open
babyycakess3 opened this issue Feb 17, 2021 · 0 comments
Open

Banner #1

babyycakess3 opened this issue Feb 17, 2021 · 0 comments

Comments

@babyycakess3
Copy link

Steps to Reproduce

  1. Run the code bellow

Expected results: to have a meaningful error message saying that the key is null

Actual results: getting a strange Dart error saying "null check operator used on a null value"

This probably reproduce on any channel with null safety enabled.

======== Exception caught by widgets library =======================================================
The following _CastError was thrown building:
Null check operator used on a null value

When the exception was thrown, this was the stack: 
#0      _ReorderableListContentState._itemBuilder (package:flutter/src/material/reorderable_list.dart:462:74)
#1      SliverReorderableListState._itemBuilder (package:flutter/src/widgets/reorderable_list.dart:811:44)
#2      SliverChildBuilderDelegate.build (package:flutter/src/widgets/sliver.dart:455:22)
#3      SliverMultiBoxAdaptorElement._build (package:flutter/src/widgets/sliver.dart:1213:28)
#4      SliverMultiBoxAdaptorElement.createChild.<anonymous closure> (package:flutter/src/widgets/sliver.dart:1226:55)
...
====================================================================================================

code sample
import 'package:flutter/material.dart';

void main() => runApp(MaterialApp(
  title: 'ReorderableListView issue',
  home: Scaffold(
    body: SizedBox(
      height: 100,
      child: ReorderableListView.builder(
        physics: ClampingScrollPhysics(),
        itemCount: 15,
        itemBuilder: (context, index) {
          return Card(
            //key: ObjectKey(index), // This cause the BUG
            child: Text("Sub Item - $index"),
          );
        },
        onReorder: (oldIndex, newIndex) {},
      ),
    ),
  ),
));
flutter doctor -v
[✓] Flutter (Channel master, 1.27.0-2.0.pre.126, on macOS 11.2 20D64 darwin-x64, locale en-AO)
    • Flutter version 1.27.0-2.0.pre.126 at /Users/pedromassango/Code/flutter_master
    • Framework revision 50897c98fc (3 hours ago), 2021-02-16 20:13:53 -0800
    • Engine revision 9bcb3bfb0e
    • Dart version 2.13.0 (build 2.13.0-30.0.dev)

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at /Users/pedromassango/Library/Android/sdk
    • Platform android-30, build-tools 30.0.2
    • 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.1, Build version 12A7403
    ! CocoaPods 1.9.3 out of date (1.10.0 is recommended).
        CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
        Without CocoaPods, plugins will not work on iOS or macOS.
        For more info, see https://flutter.dev/platform-plugins
      To upgrade see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.

[✓] 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)

[✓] IntelliJ IDEA Community Edition (version 2020.3.2)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin version 53.1.5
    • Dart plugin version 203.6912

[✓] VS Code (version 1.52.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.18.1

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-x64     • macOS 11.2 20D64 darwin-x64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 88.0.4324.182

! Doctor found issues in 1 category.

Originally posted by @pedromassangocode in flutter/flutter#76205

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

1 participant