Code Monkey home page Code Monkey logo

generator-jhipster-flutter's Introduction


Generator npm version npm

Generate your Flutter mobile App (Android / iOS) for JHipster

This is a JHipster module.

Get started and (Full not yet) documentation on my blog here

What's inside

  • Screen
    • Main
    • Register
    • Login
    • User preferences
  • Theming
    • All styles in one place
    • Light theme for now
  • Full I18n support
    • EN, FR for now
    • Automatic generation with IntelliJ plugin or VS code plugin
    • Detecting device locale
    • Change language in user preferences UI
    • Apply the preferred locale instead of the device one
  • BLoC Architecture More informations
  • JSON serializer / deserializer Java Jackson like More informations
  • Language choice
    • Java / Kotlin for Android
    • Objective C / Swift for iOS
  • Profiles / Environments
    • Dev
    • Prod
  • IntelliJ Config file for dev and prod profile

Entity generator

Generate your entity from your jhipster project

  • One by one
  • All your entities

More informations here

Prerequisites

As this is a JHipster module, we expect you have JHipster and its related tools already installed:

jhipster

Installation

With NPM

To install this blueprint:

npm install -g generator-jhipster-flutter-merlin

To update this blueprint:

npm update -g generator-jhipster-flutter-merlin

With Yarn

To install this blueprint:

yarn global add generator-jhipster-flutter-merlin

To update this blueprint:

yarn global upgrade generator-jhipster-flutter-merlin

Usage

To use this blueprint, run

yo jhipster-flutter-merlin

Running local module version for development

During development of module, please note the below steps. They are very important.

  1. Clone the projects

You'll probably need the current master of generator-jhipster :

  • fork generator-jhipster: https://github.com/jhipster/generator-jhipster/fork
  • clone locally your fork: git clone https://github.com/<your_username>/generator-jhipster
  • cd generator-jhipster
  • git remote add upstream https://github.com/jhipster/generator-jhipster
  • so you'll be able to update regularly your fork, using git fetch upstream && git checkout master && git rebase upstream/master
  • npm ci
  • npm link

Then, about jhipster-flutter :

  • fork jhipster-flutter: https://github.com/jhipster/jhipster-flutter/fork
  • clone locally your fork: git clone https://github.com/<your_username>/jhipster-flutter
  • cd jhipster-flutter
  • git remote add upstream https://github.com/jhipster/jhipster-flutter
  • so you'll be able to update regularly your fork, using git fetch upstream && git checkout master && git rebase upstream/master
  • npm ci
  • npm link
  • npm link generator-jhipster
  1. Create a new folder for the app to be generated and link JHipster and your blueprint there
mkdir my-app
cd my-app
npm link generator-jhipster-flutter-merlin
yo jhipster-flutter-merlin

Help and contribution to the project

Feel free to help, the project is open to PR

License

Apache-2.0 © Cyril Casaucau

generator-jhipster-flutter's People

Contributors

dependabot[bot] avatar merlinofcha0s avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

generator-jhipster-flutter's Issues

Following dependencies don't support null safety

Hi
When i try to flutter run command i get error message below :

Using hardware rendering with device sdk gphone x86. If you notice graphics
artifacts, consider enabling software rendering with
"--enable-software-rendering".
Launching lib\main.dart on sdk gphone x86 in debug mode...
Error: Cannot run with sound null safety, because the following dependencies
don't support null safety:

  • package:flutter_bloc
  • package:dart_json_mapper
  • package:bloc
  • package:provider
  • package:formz

For solutions, see https://dart.dev/go/unsound-null-safety

FAILURE: Build failed with an exception.

  • Where:
    Script 'C:\FlutterSDK\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 991

  • What went wrong:
    Execution failed for task ':app:compileFlutterBuildDebug'.

Process 'command 'C:\FlutterSDK\flutter\bin\flutter.bat'' finished with non-zero exit value 1

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 19s

Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 20.5s
Exception: Gradle task assembleDebug failed with exit code 1

When i try to flutter pub get i get this error :

flutter pub get
Warning: You are using these overridden dependencies:
! glob 2.0.0 (2.0.1 available)
! intl 0.17.0
! reflectable 3.0.0-nullsafety.1 (3.0.1 available)
Running "flutter pub get" in flutter-app... 1,418ms

My $flutter --version

Flutter 2.0.4 • channel stable • https://github.com/flutter/flutter.git
Framework • revision b1395592de (3 weeks ago) • 2021-04-01 14:25:01 -0700
Engine • revision 2dce47073a
Tools • Dart 2.12.2

and

My jhipster --version

INFO! Using JHipster version installed globally
7.0.1

Can't Generate Entities

Screen Shot 2020-10-13 at 19 46 18

Hi Cyril,

I am trying generate entities following your blog here
https://blog.herofactory.dev/using-the-flutter-entity-generator-jhipster/

However, I am getting an error saying it can't find a project containing the .jhipster folder where the entities.
I have already generated the entities on the server and there is a .jhipster with JSON representations of the entities.
I tried both individual entity or all the entities.

I installed the generator from npm globally also tried to install the generator as development both the flutter generator and the parent JHipster generator. I did the proper linking.

see the screenshot below
Screen Shot 2020-10-13 at 19 23 49
Screen Shot 2020-10-13 at 19 40 41
...
blow is screenshot of the folder three of the 3 project, somalivisaserver is the JHipster generated project with .jhipster folder
Screen Shot 2020-10-13 at 19 55 20

Consider converting to JHipster module

I discovered this jhispter blueprint by chance, and checked quickly the code to see how it was working (note: I've not tried it yet).

I see you're overriding the client part of JHipster (although your subgenerator is named "app"...), so this does not allow user to have both a Flutter client and a web client (Angular, React, ...).
If you switch to a JHipster module, you might provide additional feature to a JHipster application without user having to make a choice between mobile front-end and web front-end.

Note: a JHipster user can disable client side when generating a monolith application, using the --skip-client flag

Externalize entities routes

Problem

All the routes were imported in the app.dart, it means a lot of routes when you start to have a few entities (4 routes by entity)

Solution

All entity routes file are now located in the entity folder and are imported as array in the app.dart

Settings menu

Add a settings menu for managing the connected user profile like the main jhipster generator

I cant run the generator in Jhipster V7

This generator (jhipster-flutter-merlin:app) requires yeoman-environment at least 3.0.0, current version is 2.10.3,

I haven't been able to run the generator, I even tried reinstalling the latest version of "YO".
Note: I'm running the Jhipster V7 in Ubuntu(Linux
Screenshot from 2021-03-23 13-46-36
)

Error: Cannot run with sound null safety, because the following dependencies don't support null safety:

Hello,

I have created a prototype application "crmsystemtc" with JHipster v7.0.1. Now I wanted to generate a flutter app. Unfortunately I get the following error:

Error: Cannot run with sound null safety, because the following dependencies
don't support null safety:

 - package:flutter_bloc
 - package:dart_json_mapper
 - package:bloc
 - package:provider
 - package:formz

For solutions, see https://dart.dev/go/unsound-null-safety
Unhandled exception:
Bad state: Unsupported Null Safety mode NonNullableByDefaultCompiledMode.Invalid, in null.
#0      ProgramCompiler.emitModule (package:dev_compiler/src/kernel/compiler.dart:442:9)
#1      JavaScriptBundler.compile (package:frontend_server/src/javascript_bundle.dart:146:33)
#2      FrontendCompiler.writeJavascriptBundle (package:frontend_server/frontend_server.dart:638:47)
<asynchronous suspension>
#3      FrontendCompiler.compile (package:frontend_server/frontend_server.dart:549:9)
<asynchronous suspension>
#4      listenAndCompile.<anonymous closure> (package:frontend_server/frontend_server.dart:1119:11)
<asynchronous suspension>
the Dart compiler exited unexpectedly.
Waiting for connection from debug service on Chrome...             15,0s
Failed to compile application.

After I run the following command:

dart pub upgrade --null-safety --dry-run

Output:

Resolving dependencies...
Because reflectable >=2.2.5 <3.0.2 depends on build_runner ^1.10.0 and CrmSystemTc depends on build_runner >=2.0.0, reflectable >=2.2.5 <3.0.2 is forbidden.
So, because CrmSystemTc depends on reflectable 3.0.0-nullsafety.1, version solving failed.

I think that the generator does not create runnable code on the current state. How do you recommend to proceed here?

Commit reflectable mapper

No reason to not commit it and no need to run the reflection when we just checkout the project
Remove the prod since both will be the same

Issues from test run

I installed this module tonight and tried to create an app and run it. First of all, am I supposed to run yo jhipster-flutter-merlin in a directory next to my JHipster app, or inside my JHipster app?

I'm using Java 8 because I got a NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema when I tried to use Java 11.

$ java -version
openjdk version "1.8.0_242"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_242-b08)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.242-b08, mixed mode)

I tried to create flutter-app next to my JHipster app. After I created the app, I tried to run it with flutter run on Chrome. The error I received:

$ flutter run
Multiple devices found:
Android SDK built for x86 (mobile) • emulator-5554                        • android-x86    • Android 10 (API 29)
(emulator)
iPhone 11 (mobile)                 • 53F2EA71-5273-40B7-8CCA-329E12B0D3E4 • ios            •
com.apple.CoreSimulator.SimRuntime.iOS-14-4 (simulator)
Chrome (web)                       • chrome                               • web-javascript • Google Chrome 89.0.4389.82
[1]: Android SDK built for x86 (emulator-5554)
[2]: iPhone 11 (53F2EA71-5273-40B7-8CCA-329E12B0D3E4)
[3]: Chrome (chrome)
Please choose one (To quit, press "q/Q"): 3

Launching lib/main.dart on Chrome in debug mode...
Error: Cannot run with sound null safety, because the following dependencies
don't support null safety:

 - package:flutter_bloc
 - package:dart_json_mapper
 - package:bloc
 - package:provider
 - package:formz

For solutions, see https://dart.dev/go/unsound-null-safety
Unhandled exception:
Bad state: Unsupported Null Safety mode NonNullableByDefaultCompiledMode.Invalid, in null.
#0      ProgramCompiler.emitModule (package:dev_compiler/src/kernel/compiler.dart:435:9)
#1      JavaScriptBundler.compile (package:frontend_server/src/javascript_bundle.dart:144:33)
#2      FrontendCompiler.writeJavascriptBundle (package:frontend_server/frontend_server.dart:632:20)
<asynchronous suspension>
#3      FrontendCompiler.compile (package:frontend_server/frontend_server.dart:545:9)
<asynchronous suspension>
#4      listenAndCompile.<anonymous closure> (package:frontend_server/frontend_server.dart:1105:11)
<asynchronous suspension>
the Dart compiler exited unexpectedly.
Waiting for connection from debug service on Chrome...              7.2s
Failed to compile application.

Then, I tried Android. That fails too. I must be doing something wrong.

[1]: Android SDK built for x86 (emulator-5554)
[2]: iPhone 11 (53F2EA71-5273-40B7-8CCA-329E12B0D3E4)
[3]: Chrome (chrome)
Please choose one (To quit, press "q/Q"): 1

Using hardware rendering with device Android SDK built for x86. If you notice graphics artifacts, consider enabling
software rendering with "--enable-software-rendering".
Launching lib/main.dart on Android SDK built for x86 in debug mode...
Error: Cannot run with sound null safety, because the following dependencies
don't support null safety:

 - package:flutter_bloc
 - package:dart_json_mapper
 - package:bloc
 - package:provider
 - package:formz

For solutions, see https://dart.dev/go/unsound-null-safety


FAILURE: Build failed with an exception.

* Where:
Script '/usr/local/Caskroom/flutter/1.22.4/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 991

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command '/usr/local/Caskroom/flutter/1.22.4/flutter/bin/flutter'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2m 19s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done                       140.3s
Exception: Gradle task assembleDebug failed with exit code 1

FWIW, here's the backend I created with JHipster 7 main branch.

/*
 * 21-Points (https://github.com/mraible/21-points) as a WebFlux + React app
 */

application {
  config {
    applicationType monolith
    reactive true
    baseName HealthPoints
    packageName com.okta.developer
    authenticationType oauth2
    prodDatabaseType postgresql
    buildTool gradle
    testFrameworks [cypress]
    clientFramework react
    enableTranslation true
    nativeLanguage en
    languages [en, es]
  }
  entities Points, BloodPressure, Weight, Preferences
}

// JDL definition for application 'TwentyOnePoints' generated with command 'jhipster export-jdl'

entity BloodPressure {
  timestamp ZonedDateTime required,
  systolic Integer required,
  diastolic Integer required
}
entity Weight {
  timestamp ZonedDateTime required,
  weight Double required
}
entity Points {
  date LocalDate required,
  exercise Integer,
  meals Integer,
  alcohol Integer,
  notes String maxlength(140)
}
entity Preferences {
  weeklyGoal Integer required min(10) max(21),
  weightUnits Units required
}

enum Units {
  KG,
  LB
}

relationship OneToOne {
  Preferences{user(login)} to User
}
relationship ManyToOne {
  BloodPressure{user(login)} to User,
  Weight{user(login)} to User,
  Points{user(login)} to User
}

paginate BloodPressure, Weight with infinite-scroll
paginate Points with pagination

I'm guessing you don't support OIDC auth yet since there are open issues for Keycloak and Okta. If it helps to create bug bounties for these, I'd be happy to do that.

If I generate a reactive app with JWT for auth, should it work?

Issues when creating an entity with a multiword name

Hi Cyril,

I'm trying to generate entities with a name that consist of several words (for example CatalogItem) but getting errors in generated files.

Could you please, make following corrections:

In the file generators/entity/index.js:
image

In the file generators/entity/templates/flutter/lib/entity.model.ejs:
image

Best regards
Ivan

Error: Method not found: 'initializeJsonMapper'

Could you help me with this error that appears in the image, or give me some clue...?

Captura de pantalla 2022-12-30 a las 13 42 40

`
#> flutter doctor
Doctor summary (to see all details, run flutter doctor -v):

  • [✓] Flutter (Channel stable, 3.3.10, on macOS 13.1 22C65 darwin-x64, locale es-ES)
  • [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
  • [✓] Xcode - develop for iOS and macOS (Xcode 14.2)
  • [✓] Chrome - develop for the web
  • [✓] Android Studio (version 2021.3)
  • [✓] IntelliJ IDEA Community Edition (version 2022.2.3)
  • [✓] VS Code (version 1.74.2)
  • [✓] Connected device (3 available)
  • [✓] HTTP Host Availability
    `

Thank you.

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

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.