Open mraible opened 3 years ago
Hi,
Sorry for the late answer.
Yes, you are supposed to launch yo jhipster-flutter-merlin
in your generated jhipster project.
Normally you are supposed to use the java version linked with the Android SDK that you downloaded. I'm not sure that it will work with regular JDK but not 100% sure (see screen capture below).
For your last problem, You have either to use the generated launcher present in the run configuration (.idea) it's because all the libraries are not ready for null safety so you have to add --no-sound-null-safety
with your flutter run : flutter run --no-sound-null-safety
.
Sure, for the bug bounties, it will be awesome !
And yes it will work with JWT reactive or not.
Tell me if something wasn't clear enough.
I tried this again tonight with my jhipster7-demo app that uses JHipster v7.0.1 and JWT for auth.
When I run flutter run --no-sound-null-safety
, I get the following error:
** BUILD FAILED **
Xcode's output:
↳
lib/main.dart:4:8: Error: Error when reading 'lib/main.mapper.g.dart': No such file or directory
import 'main.mapper.g.dart' show initializeJsonMapper;
^
lib/main.dart:9:3: Error: Method not found: 'initializeJsonMapper'.
initializeJsonMapper();
^^^^^^^^^^^^^^^^^^^^
Failed to package /Users/mraible/dev/jhipster7-demo/flutter-app.
You can see the code for this in https://github.com/mraible/jhipster7-demo/pull/7, or by cloning the repo/branch:
git clone -b flutter https://github.com/mraible/jhipster7-demo
I tried this again tonight with my jhipster7-demo app that uses JHipster v7.0.1 and JWT for auth.
When I run
flutter run --no-sound-null-safety
, I get the following error:** BUILD FAILED ** Xcode's output: ↳ lib/main.dart:4:8: Error: Error when reading 'lib/main.mapper.g.dart': No such file or directory import 'main.mapper.g.dart' show initializeJsonMapper; ^ lib/main.dart:9:3: Error: Method not found: 'initializeJsonMapper'. initializeJsonMapper(); ^^^^^^^^^^^^^^^^^^^^ Failed to package /Users/mraible/dev/jhipster7-demo/flutter-app.
You can see the code for this in mraible/jhipster7-demo#7, or by cloning the repo/branch:
git clone -b flutter https://github.com/mraible/jhipster7-demo
You should run " flutter pub run build_runner build --delete-conflicting-outputs", this will update (or create if not exist) the file main.mapper.g.dart, that's because of dart_json_mapper_flutter lib. It is an issue of build runner that didn't display some errors! (in this case, dart version between your drat sdk and targeted by the generated code)
Also, notice that this jhipster module does not support JHipster 7, but with some workaround it will as I did for one of my projects based on JHipster 7, notice also the null safety issues with generated pubspec, here it mine after updating some libs: ` environment: sdk: ">=2.14.0 <3.0.0"
dependencies: flutter: sdk: flutter flutter_localizations: sdk: flutter cupertino_icons: ^1.0.3 http: any dart_json_mapper: ^2.1.16 dart_json_mapper_flutter: ^1.0.3 flutter_secure_storage: ^4.2.1 url_launcher: ^6.0.12 datetime_picker_formfield: ^2.0.0 introduction_screen: ^2.1.0
toggle_switch: ^1.2.0
cached_network_image: ^3.1.0
formz: ^0.4.1 equatable: ^2.0.0 flutter_bloc: ^7.3.1
google_maps_flutter: ^2.0.11 custom_info_window: ^1.0.1 clippy_flutter: ^2.0.0-nullsafety.1
qr_flutter: ^4.0.0 glob: ^2.0.2 reflectable: ^3.0.4 intl: ^0.17.0 search_choices: ^2.0.14 video_player: ^2.2.6 firebase_core: "^1.10.0" firebase_messaging: "^11.1.0" form_builder_phone_field: ^1.0.0-beta.0
barcode_widgets: ^2.0.0 flutter_svg: maps_launcher: ^2.0.1 ...... ` Hope this could help you
I tried updating my dependencies. See https://github.com/mraible/jhipster7-demo/pull/7/commits/c9f4babfa7ddb84a4d88260b9b078f7b637ce2a9 for specific versions.
Now if I run:
flutter pub run build_runner build --delete-conflicting-outputs
It seems to succeed:
[INFO] Succeeded after 12.7s with 1 outputs (1 actions)
When I try flutter run
, it seems to want to connect to Chrome. Is there something I need to do after running this command to see the app?
flutter run
Launching lib/main.dart on Chrome in debug mode...
lib/account/login/login_repository.dart:12:23: Error: A value of type 'JWTToken?' can't be returned from an async
function with return type 'Future<JWTToken>' because 'JWTToken?' is nullable and 'Future<JWTToken>' isn't.
- 'JWTToken' is from 'package:Flickr/shared/models/jwt_token.dart' ('lib/shared/models/jwt_token.dart').
- 'Future' is from 'dart:async'.
return JsonMapper.deserialize<JWTToken>(authenticateRequest.body);
^
lib/shared/repository/account_repository.dart:25:23: Error: A value of type 'User?' can't be returned from an async
function with return type 'Future<User>' because 'User?' is nullable and 'Future<User>' isn't.
- 'User' is from 'package:Flickr/shared/models/user.dart' ('lib/shared/models/user.dart').
- 'Future' is from 'dart:async'.
return JsonMapper.deserialize<User>(saveRequest.body);
^
Waiting for connection from debug service on Chrome... 17.6s
Failed to compile application.
I tried updating my dependencies. See mraible/jhipster7-demo@c9f4bab for specific versions.
Now if I run:
flutter pub run build_runner build --delete-conflicting-outputs
It seems to succeed:
[INFO] Succeeded after 12.7s with 1 outputs (1 actions)
When I try
flutter run
, it seems to want to connect to Chrome. Is there something I need to do after running this command to see the app?flutter run Launching lib/main.dart on Chrome in debug mode... lib/account/login/login_repository.dart:12:23: Error: A value of type 'JWTToken?' can't be returned from an async function with return type 'Future<JWTToken>' because 'JWTToken?' is nullable and 'Future<JWTToken>' isn't. - 'JWTToken' is from 'package:Flickr/shared/models/jwt_token.dart' ('lib/shared/models/jwt_token.dart'). - 'Future' is from 'dart:async'. return JsonMapper.deserialize<JWTToken>(authenticateRequest.body); ^ lib/shared/repository/account_repository.dart:25:23: Error: A value of type 'User?' can't be returned from an async function with return type 'Future<User>' because 'User?' is nullable and 'Future<User>' isn't. - 'User' is from 'package:Flickr/shared/models/user.dart' ('lib/shared/models/user.dart'). - 'Future' is from 'dart:async'. return JsonMapper.deserialize<User>(saveRequest.body); ^ Waiting for connection from debug service on Chrome... 17.6s Failed to compile application.
After solving the above error by catching null values, I get the following error:
════════════════════════════════════════════════════════════════════════════════════════════════════
════════ Exception caught by gesture ═══════════════════════════════════════════════════════════════
The following StateError was thrown while handling a gesture:
Bad state: add(TermsAndConditionsChanged) was called without a registered event handler.
Make sure to register a handler via on<TermsAndConditionsChanged>((event, emit) {...})
When the exception was thrown, this was the stack:
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 251:49 throw_
packages/bloc/src/bloc.dart 75:9 <fn>
packages/bloc/src/bloc.dart 80:14 add
packages/eyeCare/account/register/register_screen.dart 136:53 <fn>
packages/flutter/src/material/toggleable.dart 229:9 [_handleTap]
packages/flutter/src/gestures/recognizer.dart 198:24 invokeCallback
packages/flutter/src/gestures/tap.dart 608:48 handleTapUp
packages/flutter/src/gestures/tap.dart 296:5 [_checkUp]
packages/flutter/src/gestures/tap.dart 230:7 handlePrimaryPointer
packages/flutter/src/gestures/recognizer.dart 563:9 handleEvent
packages/flutter/src/gestures/pointer_router.dart 94:12 [_dispatch]
packages/flutter/src/gestures/pointer_router.dart 139:9 <fn>
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/linked_hash_map.dart 21:13 forEach
packages/flutter/src/gestures/pointer_router.dart 137:17 [_dispatchEventToRoutes]
packages/flutter/src/gestures/pointer_router.dart 123:7 route
packages/flutter/src/gestures/binding.dart 439:19 handleEvent
packages/flutter/src/gestures/binding.dart 419:14 dispatchEvent
packages/flutter/src/rendering/binding.dart 322:11 dispatchEvent
packages/flutter/src/gestures/binding.dart 374:7 [_handlePointerEventImmediately]
packages/flutter/src/gestures/binding.dart 338:5 handlePointerEvent
packages/flutter/src/gestures/binding.dart 296:7 [_flushPointerEventQueue]
packages/flutter/src/gestures/binding.dart 279:32 [_handlePointerDataPacket]
C:/b/s/w/ir/cache/builder/src/out/host_debug/flutter_web_sdk/lib/_engine/engine/platform_dispatcher.dart 1020:13 invoke1
C:/b/s/w/ir/cache/builder/src/out/host_debug/flutter_web_sdk/lib/_engine/engine/platform_dispatcher.dart 184:5 invokeOnPointerDataPacket
C:/b/s/w/ir/cache/builder/src/out/host_debug/flutter_web_sdk/lib/_engine/engine/pointer_binding.dart 130:39 [_onPointerData]
C:/b/s/w/ir/cache/builder/src/out/host_debug/flutter_web_sdk/lib/_engine/engine/pointer_binding.dart 558:18 <fn>
C:/b/s/w/ir/cache/builder/src/out/host_debug/flutter_web_sdk/lib/_engine/engine/pointer_binding.dart 511:21 <fn>
C:/b/s/w/ir/cache/builder/src/out/host_debug/flutter_web_sdk/lib/_engine/engine/pointer_binding.dart 217:16 loggedHandler
Handler: "onTap"
Recognizer: TapGestureRecognizer#6610a
debugOwner: GestureDetector
state: possible
won arena
finalPosition: Offset(32.0, 711.0)
finalLocalPosition: Offset(17.0, 10.9)
button: 1
sent tap down
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.I tried to create
flutter-app
next to my JHipster app. After I created the app, I tried to run it withflutter run
on Chrome. The error I received:Then, I tried Android. That fails too. I must be doing something wrong.
FWIW, here's the backend I created with JHipster 7 main branch.
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?