Comments (16)
Ok thanks. I didn't know I could name my observers. That helped me in resolving the issue
from mobx.dart.
Few observations.
@observable
bool get loading => loadingButtonStatus
should not be an observable.
change it to this:
@computed
bool get loading => loadingButtonStatus
Having said that if you had used
store.loadingButtonStatus
Then it should have also worked. And loading
becomes redundant. But if you must use loading
, then set it to @computed, run
flutter packages pub run build_runner watch --delete-conflicting-outputs
And try again
from mobx.dart.
@Timbabs thanks a lot mate!.
the one thing that i forget is to run that build_runner. it still using the old function i created!
and of course that loading should be @computed. 💃
from mobx.dart.
I would start by giving names to few Observers
that you think are the culprits. This would have to be done by trial and error for now 😢. You could give a name like so:
Observer(name: 'test', builder: (_) {});
If you see the message with that name, you know you got your culprit.
from mobx.dart.
@yaymalaga
So if I get your question correctly, you're asking which of this?
1)
(in your store class)
@observable
bool loading
(in your widget class)
Observer(
name: 'loading_button',
builder: (_) => LoadingButton(
loading: store.loading,
))
or
2)
(in your store class)
@observable
bool _loading
@computed
bool get loading => _loading
(in your widget class)
Observer(
name: 'loading_button',
builder: (_) => LoadingButton(
loading: store.loading,
))
Both work fine. So it's your choice.
I will go for the later if concerned about class encapsulation.
from mobx.dart.
Fixed with #111
from mobx.dart.
I get this message:
There are no observables detected in the builder function for Observer@18
How can I trace Observer@18?
from mobx.dart.
Can you share the build()
method where the Observer
is being used? Also are you running the build_runner
?
from mobx.dart.
That's the problem. How do I know which of my observers is observer@18?
from mobx.dart.
Ok thanks. I didn't know I could name my observers. That helped me in resolving the issue
Great to know that. Perhaps you can make a blog post or send me a note on how you solved it and I can add it to the Guides section on mobx.pub :-)
from mobx.dart.
Great to know that. Perhaps you can make a blog post or send me a note on how you solved it and I can add it to the Guides section on mobx.pub :-)
Will do that
from mobx.dart.
Hi,
I'm experiencing same issue with this error "There are no observables detected in the builder function"
abstract class _AccountStore with Store {
@observable
bool loadingButtonStatus = false;
@observable
bool get loading => loadingButtonStatus;
@action
Future updateAccount(formData) async {
loadingButtonStatus = true;
Future.delayed(Duration(milliseconds: 2000)).then((future) {
loadingButtonStatus = false;
}).catchError((e) {
loadingButtonStatus = false;
print(e);
});
}
}
here is my widget
AccountStore store = AccountStore();
Observer(
name: 'loading_button',
builder: (_) => LoadingButton(
loading: store.loading,
text: Text('Save'),
onPressed: () {
store.updateAccount({});
},
))
But everytime i run the code it always return me: There are no observables detected in the builder function
I've tried changed use store.loadingButtonStatus
still the same.
any solution?
from mobx.dart.
@Timbabs Just out of curiosity, I would like to know which between the @computed or the @observable is recommended for a simple getter.
I mean, if I have a private observable variable like loading, is it better to just make it public and use the Observable widget, or let it remain public and use anyways the computed getter?
from mobx.dart.
Class encapsulation is the motivation for #220. It feels awkward to have to do a private observable and a public computed for every property of a store you want to encapsulate. I'm not sure if that syntax is best but ideally the code generator could provide a better solution.
from mobx.dart.
Hi !
Im getting this error message:
Reloaded application in 1.070ms.
Performing hot restart... 1.071ms
-- AppModule INITIALIZED
-- ClientModule INITIALIZED
No observables detected in the build method of UserName
package:flutter_web_mobile/app/modules/client/client_page.dart 169:1 build
File client_page_dart:
body: Form(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
Observer(
name: 'UserName',
builder: (_) => TextField(
decoration: InputDecoration(
labelText: 'Username',
hintText: 'Pick a username',
errorText: 'Erro'
),
),
),
from mobx.dart.
In your builder function, there is no observable
that is being used. All appear to be plain strings.
Also when pasting code enclose them in triple backticks. It makes it easier for others to read your code.
```
your code
```
from mobx.dart.
Related Issues (20)
- Unable to use MultiReactionBuilder HOT 3
- [question] when is it mandatory to use runInAction
- Issue In ObservableList while using addAll method with iterables.
- Feature request: static analysis for empty `Observer`
- [Codegen] name used in generated mixin has to be constant to reduce compiled app size (especially important for Flutter Web) HOT 1
- [Question] No observables detected when checking in a ternary operator inside of a child parameter HOT 1
- Make the Observer to rebuild when no changes in immediate context HOT 2
- `ObservableSet` and `ObservableMap` notify all listeners when one is added with `fireImmediately: true`
- Observer widget doesnt observe the new state (Flutter web)
- late reactions not working HOT 5
- Error happened when building Observer, but it was captured since disableErrorBoundaries==true HOT 1
- Computeds not working when Observer in Observer HOT 6
- Can't use nullable type alias in computed; `null check operator used on null value` HOT 2
- ObservableMap not notifying Observer mobx 2.2.3 it was woking fine in 2.2.1 HOT 6
- feat: add requiresReaction to `Computed`
- feat: add keepAlive to Computed
- feat: add scheduler option to autorun and reaction HOT 1
- feat: add signal option to reactions
- How to wait ObservableFuture.status in function?
- testWidgets with Store not working properly HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mobx.dart.