mobxjs / mobx.dart

MobX for the Dart language. Hassle-free, reactive state-management for your Dart and Flutter apps.
https://mobx.netlify.app
MIT License
2.39k stars 310 forks source link

Error happened when building Observer, but it was captured since disableErrorBoundaries==true #961

Open rkundnani opened 9 months ago

rkundnani commented 9 months ago

getting this error

Error happened when building Observer, but it was captured since disableErrorBoundaries==true

I/flutter (13988): No observables detected in the build method of Observer I/flutter (13988): Observer constructed from: BondsWebWidgetState.build package:cherry/…/components/webview_bonds_widget.dart:166

code :

widget class :

@override
  Widget build(BuildContext context) {
    return WillPopScope(
      onWillPop: _onBackPressed,
      child: Observer(
        builder:(context) { 
          return Scaffold(
          appBar:  viewModel.loadMessageFromNsdl ? AppBar() : null,
          body: Container(
            padding: const EdgeInsets.only(top: kToolbarHeight),
            height: MediaQuery.of(context).size.height,
            child: WebViewWidget(controller: _controller, gestureRecognizers: {
              Factory<DragGestureRecognizer>(
                () => VerticalDragGestureRecognizer(),
              ),
            }),
          ),
        );
         },
      ),
      );
  }

store class:

@observable
  bool loadMessageFromNsdl = false;

  @action
  void toShowAppBarFunction(bool toShowAppBar){
    loadMessageFromNsdl = toShowAppBar;
  }
amondnet commented 8 months ago

@rkundnani

appBar:  viewModel.loadMessageFromNsdl ? AppBar() : null,

Are there any other conditions on this line? Could it be related to the this issue?