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

Null check operator used on a null value #29

Open
lvyandev opened this issue Mar 11, 2022 · 0 comments
Open

Null check operator used on a null value #29

lvyandev opened this issue Mar 11, 2022 · 0 comments

Comments

@lvyandev
Copy link

Describe the bug
A clear and concise description of what the bug is.

    await FilterListDialog.display<T>(
      this,
      listData: data,
      choiceChipLabel: (T? data) => titleBuilder?.call(data),
      validateSelectedItem: selectedDataValidator,
      onItemSearch: (T data, String query) =>
          searchComparator?.call(data, query) ??
          titleBuilder
              ?.call(data)
              ?.toLowerCase()
              .contains(query.toLowerCase()) ??
          false,
      hideSelectedTextCount: true,
      hideSearchField: true,
      allButtonText: MaterialLocalizations.of(this).selectAllButtonLabel,
      resetButtonText: 'reset'.translateAction(),
      applyButtonText: MaterialLocalizations.of(this).saveButtonLabel,
      onApplyButtonClick: (List<T>? data) => _completer.complete(data),
    );


======== Exception caught by gesture ===============================================================
The following _CastError was thrown while handling a gesture:
Null check operator used on a null value

When the exception was thrown, this was the stack: 
#0      FilterState.addSelectedItem (package:filter_list/src/state/filter_state.dart:46:18)
#1      ChoiceList._buildChoiceList.<anonymous closure>.<anonymous closure> (package:filter_list/src/widget/choice_list.dart:52:25)
#2      _RawChipState._handleTap (package:flutter/src/material/chip.dart:1716:24)
#3      _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:989:21)
#4      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:198:24)
#5      TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:608:11)
#6      BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:296:5)
#7      BaseTapGestureRecognizer.acceptGesture (package:flutter/src/gestures/tap.dart:267:7)
#8      GestureArenaManager.sweep (package:flutter/src/gestures/arena.dart:157:27)
#9      GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:443:20)
#10     GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:419:22)
#11     RendererBinding.dispatchEvent (package:flutter/src/rendering/binding.dart:322:11)
#12     GestureBinding._handlePointerEventImmediately (package:flutter/src/gestures/binding.dart:374:7)
#13     GestureBinding.handlePointerEvent (package:flutter/src/gestures/binding.dart:338:5)
#14     GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:296:7)
#15     GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:279:7)
#19     _invoke1 (dart:ui/hooks.dart:170:10)
#20     PlatformDispatcher._dispatchPointerDataPacket (dart:ui/platform_dispatcher.dart:331:7)
#21     _dispatchPointerDataPacket (dart:ui/hooks.dart:94:31)
(elided 3 frames from dart:async)
Handler: "onTap"
Recognizer: TapGestureRecognizer#f56cc
  debugOwner: GestureDetector
  state: ready
  won arena
  finalPosition: Offset(153.4, 286.0)
  finalLocalPosition: Offset(34.2, 16.0)
  button: 1
  sent tap down
====================================================================================================

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

 // Add item in to selected list
  void addSelectedItem(K item) {
    _selctedItems!.add(item); // _selctedItems wasn't initialized

    notifyListeners();
  }

  // Remove item from selected list
  void removeSelectedItem(K item) {
    _selctedItems!.remove(item);

    notifyListeners();
  }

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

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