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 #2092

Open
doronnahum opened this issue Dec 30, 2021 · 6 comments
Open

Null check operator used on a null value #2092

doronnahum opened this issue Dec 30, 2021 · 6 comments
Assignees

Comments

@doronnahum
Copy link

Hi,
in some cases when i change view
i get this exception:

location: GetStream.removeSubscription (package:get/get_rx/src/rx_stream/get_stream.dart:22:17)
error: Null check operator used on a null value
code: "
FutureOr<bool?> removeSubscription(LightSubscription subs) async {
if (!_isBusy!) {
"

#0 GetStream.removeSubscription (package:get/get_rx/src/rx_stream/get_stream.dart:22:17)
#1 LightSubscription.cancel (package:get/get_rx/src/rx_stream/get_stream.dart:148:24)
#2 NotifyManager.close. (package:get/get_rx/src/rx_types/rx_core/rx_impl.dart:183:22)
#3 _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:539:8)
#4 NotifyManager.close (package:get/get_rx/src/rx_types/rx_core/rx_impl.dart:181:20)
#5 _ObxState.dispose (package:get/get_state_manager/src/rx_flutter/rx_obx_widget.dart:48:15)
#6 StatefulElement.unmount (package:flutter/src/widgets/framework.dart:4818:11)
#7 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1883:13)
#8 _InactiveElements._unmount. (package:flutter/src/widgets/framework.dart:1881:7)
#9 ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4642:14)
#10 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1879:13)
#11 _InactiveElements._unmount. (package:flutter/src/widgets/framework.dart:1881:7)
#12 SingleChildRenderObjectElement.visitChildren (package:flutter/src/widgets/framework.dart:6110:14)
#13 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1879:13)
#14 _InactiveElements._unmount. (package:flutter/src/widgets/framework.dart:1881:7)
#15 SingleChildRenderObjectElement.visitChildren (package:flutter/src/widgets/framework.dart:6110:14)
#16 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1879:13)
#17 _InactiveElements._unmount. (package:flutter/src/widgets/framework.dart:1881:7)
#18 SingleChildRenderObjectElement.visitChildren (package:flutter/src/widgets/framework.dart:6110:14)
#19 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1879:13)
#20 _InactiveElements._unmount. (package:flutter/src/widgets/framework.dart:1881:7)
#21 ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4642:14)
#22 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1879:13)
#23 _InactiveElements._unmount. (package:flutter/src/widgets/framework.dart:1881:7)
#24 MultiChildRenderObjectElement.visitChildren (package:flutter/src/widgets/framework.dart:6225:16)
#25 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1879:13)
#26 _InactiveElements._unmount. (package:flutter/src/widgets/framework.dart:1881:7)
#27 SingleChildRenderObjectElement.visitChildren (package:flutter/src/widgets/framework.dart:6110:14)
#28 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1879:13)
#29 _InactiveElements._unmount. (package:flutter/src/widgets/framework.dart:1881:7)
#30 ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:4642:14)
#31 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1879:13)
#32 ListIterable.forEach (dart:_internal/iterable.dart:39:13)
#33 _InactiveElements._unmountAll (package:flutter/src/widgets/framework.dart:1892:25)
#34 BuildOwner.finalizeTree. (package:flutter/src/widgets/framework.dart:2837:27)
#35 BuildOwner.lockState (package:flutter/src/widgets/framework.dart:2468:15)
#36 BuildOwner.finalizeTree (package:flutter/src/widgets/framework.dart:2836:7)
#37 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:884:19)
#38 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:363:5)
#39 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1145:15)
#40 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1082:9)
#41 SchedulerBinding.scheduleWarmUpFrame. (package:flutter/src/scheduler/binding.dart:863:7)
#42 Timer._createTimer. (dart:async-patch/timer_patch.dart:18:15)
#43 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:395:19)
#44 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:426:5)
#45 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)

@hungryemon
Copy link

Same Issure

@igorvidottof
Copy link

Same here... Any updates on that?

@GelidGeorge
Copy link

GelidGeorge commented Oct 11, 2022

try something like this...

Closing RxFoo in OnClose() {
rxFoo.subject.isClosed? rxFoo.close() : null
}

this is not healthy but a quick fix...

or Do Your Navigation and State Management Differently and Efficeiently.

@macy11
Copy link

macy11 commented Feb 20, 2023

What's the reason?

@GelidGeorge
Copy link

Some streams might be closed in some other methods of a class, this results in trying to close a stream that's already closed. So better thing to do is check if the stream in question is already closed or create a clean code that will not result in this to happen. I recommend using “flutter_bloc” as this is an overkill and doesn't give many options like “go_router” and “flutter_bloc” gives you. Well, I have decided not use getx any time soon for any of the projects that I do in the near future.

@jahidsakan
Copy link

Im facing same issue . any solution?

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

7 participants