merlinofcha0s / generator-jhipster-flutter

A Flutter module for JHipster. It will generate mobile app (iOS, Android) with Flutter
https://cyril-casaucau.medium.com/get-started-with-the-flutter-generator-for-jhipster-11ed2b1f038d
54 stars 23 forks source link

[SEVERE] reflectable:reflectable on lib/main.dart: #37

Closed amcsoftsolutions closed 3 years ago

amcsoftsolutions commented 3 years ago

Hi Cyril,

thanks for this amazing Flutter app Generator, I have been playing around with the generator, but I get an error when I try to to generate it, also the generated projects doesn't run.

I have attached two screens. I have followed all the steps in your getting started post.

building the app with this command didn't even help. flutter pub run build_runner build or flutter pub run build_runner build --delete-conflicting-outputs

Screen Shot 2020-10-10 at 00 48 09 Screen Shot 2020-10-10 at 00 52 42
merlinofcha0s commented 3 years ago

Hi, I have found the problem, I have to upgrade dart JSON Mapper and the build runner It will be available in the next version.

For now, if you want to fix it on your side you can bump :

I think it will work

ahmedcatch commented 3 years ago

Hi Cyril, Thanks for the quick fix, I really appreciate. I have tested and it works now, All I had to do was, to replace the new changes you have added to the pubspec.yaml file:

and run flutter pub run build_runner build

Screen Shot 2020-10-13 at 12 10 27
ahmedcatch commented 3 years ago

Hi Cyril, I have a group of 4 Juniors who are learning Flutter, and I asked them to start learning the structure of the Flutter Application your generator generates. After that, I will ask them to learn about the generator itself so that they can contribute the generator. The generated mobile app, the React Web App, and the JHipster backend server project will be available on this github public repositories. https://github.com/AMC-Software-Solution

The idea is, to developer An Online Visa Application system for Somalia which currently doesn't have. We are developing and donating the system to Somalia since we are from Somalia and they don't seem to develop it by themselves anytime soon. We are also making the system opensource so that anyone can use it. The system will be including an iOS and Android application developed with Flutter using your Flutter Generator, React Applicant/Employee Visa Application page, and the backend JHIPSTER server system

merlinofcha0s commented 3 years ago

Alright, glad it worked !

That's a really nice and interesting project, thanks for choosing this generator for building this visa system app.

if you have any feedback tell me, it will be appreciate.

ahmedcatch commented 3 years ago

thanks we will keep you posted

k-paxian commented 3 years ago

@merlinofcha0s

Hey, I've noticed you've updated dart_json_mapper to the latest version 1.6.3 without reading readme. Just want to let you know there are few changes in the setup process. It would be great if you'll update them in your template.

  1. Update build.yaml

    targets:
    $default:
    builders:
      dart_json_mapper:
          generate_for:
            - lib/main.dart
    
      # This part is needed to tell original reflectable builder to stay away
      # it overrides default options for reflectable builder to an **empty** set of files
      reflectable:
        generate_for:
          - no/files
  2. Change initialization code in main.dart

import 'main.reflectable.dart'; => import 'main.mapper.g.dart' show initializeJsonMapper;

initializeReflectable => initializeJsonMapper

  1. (Optional) In your mapper.dart(https://github.com/merlinofcha0s/jhipster-flutter-sample-app/blob/master/lib/mapper.dart) there is no need for your adapter anymore. Since 1.6.3 this adapter will be generated for List<T> and Set<T> on the fly as a part of main.mapper.g.dart file.

  2. (Optional) If you still need short enum converter for all enums, you could replace your custom converter with the built-in one like this:

    JsonMapper().useAdapter(JsonMapperAdapter(converters: {Enum: enumConverterShort}));

    OR

    // lib/main.dart
    void main() {
    initializeJsonMapper(adapters: [
    JsonMapperAdapter(converters: {Enum: enumConverterShort})
    ]);
    }
merlinofcha0s commented 3 years ago

I think the changelog is not quite clear about this breaking change (https://pub.dev/packages/dart_json_mapper/changelog) and the new way of initialize the mapper in the 1.6.x.

But thanks for letting me know about this issue, for now it's okay because the PR for bumping all dependencies is not merged yet. So I'll make the change on this PR.

k-paxian commented 3 years ago

Yeah, sorry for that. Technically this is not a "breaking change" since it's not breaking anything. It's like a complementary feature accessible via those changes, otherwise it works as before.

My goal is to dissolve the need for this extra file mapper.dart from your side, to simplify bootstrapping and configuration process. For now this file covers two points:

Thank you!

merlinofcha0s commented 3 years ago

I see, and I didn't notice those changes. that's very interesting I get rid of a lot of code now, especially for the entity generator. It's more elegant for the list and enum it's working out of the box !

Thanks !