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

could not generate main.reflectable.dart and need a simple mobx example #27

Closed
deadsoul44 opened this issue Jan 19, 2020 · 12 comments
Closed
Assignees
Labels
good first issue Good for newcomers question Further information is requested

Comments

@deadsoul44
Copy link

Hello,

Thanks for the great library,

I couldn't generate main.reflectable.dart file. I tried to follow the basic setup. I pasted all the additional code in my main.dart file and run the command pub run build_runner build. I get the following error:

'pub' is not recognized as an internal or external command, operable program or batch file.

flutter pub run build_runner build command works but it does not generate main.reflectable.dart file.

Besides, I need a very simple mobx example with a separate store. I am especially interested in very nested json deserialization. This could be used for example json: https://jsonplaceholder.typicode.com/posts

I already starred the repo. Thank you very much in advance.

@k-paxian k-paxian self-assigned this Jan 19, 2020
@k-paxian k-paxian added good first issue Good for newcomers question Further information is requested labels Jan 19, 2020
@k-paxian
Copy link
Owner

Hey, welcome!
Things to check

  • Make sure your build.yml has listed your main.dart
  • Make sure your Dart code has at least one class annotated with @jsonSerializable

@deadsoul44
Copy link
Author

It is working now. There was a trivial error in build.yaml file. Thank you again.

@pavanpodila
Copy link

I am having a similar issue here. Inspite of a correct build.yml and having a @jsonSerializable, nothing gets generated during the build process.

@k-paxian k-paxian reopened this Mar 18, 2020
@k-paxian
Copy link
Owner

Well, there should be something different in a setup. Since latest lib version is built successfully on GitHub actions, including unit tests.

@pavanpodila
Copy link

This is the class I'm trying to serialize. Not sure why it is not getting picked up. Rest of the setup is as outlined in the docs.

@jsonSerializable
class FeedItem = _FeedItem with _$FeedItem;

@jsonSerializable
abstract class _FeedItem with Store {
  _FeedItem({this.message, this.user, this.timestamp, this.type});

  final String message;
  final String user;
  final String type;
  final DateTime timestamp;
}

@k-paxian
Copy link
Owner

Can you please setup a sample repository to replicate the issue, this will surely speeds up resolution.

At the moment I don't see anything suspicious.

@bounty1342
Copy link

@pavanpodila, can you try to reference/instanciate a Feeditem() somewhere in your project and relaunch the build. Does it change anything ?

May have encounter this also. Should be easy enough to replicate if that the case.

@pavanpodila
Copy link

Nothing changes even when it is referenced 😟

@kwaak
Copy link

kwaak commented Mar 19, 2020

This is the class I'm trying to serialize. Not sure why it is not getting picked up. Rest of the setup is as outlined in the docs.

@jsonSerializable
class FeedItem = _FeedItem with _$FeedItem;

@jsonSerializable
abstract class _FeedItem with Store {
  _FeedItem({this.message, this.user, this.timestamp, this.type});

  final String message;
  final String user;
  final String type;
  final DateTime timestamp;
}

Try changing class FeedItem = _FeedItem with _$FeedItem; to class FeedItem extends _FeedItem with _$FeedItem {}

And check if it does appear in your main.reflectable.dart after running the build runner.

@pavanpodila
Copy link

Tried that, but still doesn't seem to generate the main.reflectable.dart file. I'll see if I can take some time out to create a repro

@k-paxian
Copy link
Owner

@pavanpodila Here is the minimal working repo with your case.
https://github.com/k-paxian/dart-json-mapper-mob-x-integration
Hope this will be useful.

@pavanpodila
Copy link

Thanks @k-paxian ! I'll see what I'm doing different in my repo. Looks like an env issue at my end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers question Further information is requested
Projects
None yet
Development

No branches or pull requests

5 participants