Skip to content

第15章的一些建议 #112

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

Open
mjiee opened this issue Apr 6, 2022 · 1 comment
Open

第15章的一些建议 #112

mjiee opened this issue Apr 6, 2022 · 1 comment

Comments

@mjiee
Copy link

mjiee commented Apr 6, 2022

1、建议将 pubspec.yaml 文件中的依赖项配置贴出
2、代码块中建议不要将import语句省略
3、15.3小节中 “生成Dart Model类” 小节的 “flutter packages pub run json_model” 无法生成Dart Model类

$ flutter pub run json_model
Unhandled exception:
FileSystemException: Directory listing failed, path = './Jsons/' (OS Error: No such file or directory, errno = 2)
#0 _Directory._fillWithDirectoryListing (dart:io-patch/directory_patch.dart:42:24)
#1 _Directory.listSync (dart:io/directory_impl.dart:243:5)
#2 generateModelClass (file:///opt/flutter/.pub-cache/hosted/pub.dartlang.org/json_model-1.0.0/bin/json_model.dart:62:24)
#3 main (file:///opt/flutter/.pub-cache/hosted/pub.dartlang.org/json_model-1.0.0/bin/json_model.dart:46:14)
#4 _delayEntrypointInvocation. (dart:isolate-patch/isolate_patch.dart:295:32)
#5 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)
pub finished with exit code 255

我的 pubspec.yaml 依赖配置如下
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
json_annotation: ^4.4.0
dio: ^4.0.6

dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^1.0.0
build_runner: ^2.1.8
json_serializable: ^6.1.5
json_model: ^1.0.

我运行:flutter pub run json_model src=jsons dist=lib/models 也无法解决问题
将根目录下的 jsons目录 修改为 Jsons 方可生成Model文件

@zhurizhao
Copy link

第15章这么重要,整个逻辑框架很好,结果代码小问题挺多。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants