工作生活

flutter使用json

2019-07-02  本文已影响0人  pengshuangta
一、先上demo: github_json_demo
二、json快速转模型的步骤:
dependencies:
  flutter:
    sdk: flutter

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^0.1.2
  json_annotation: ^2.4.0

dev_dependencies:
  flutter_test:
    sdk: flutter
  build_runner: ^1.6.0
  json_serializable: ^3.0.0
image.png
# 命令的作用是监听生成xxx_model.g.dart文件,每次文件更改,会自动生成;
flutter packages pub run build_runner watch
image.png
三、参考链接:

参考一
参考二

上一篇 下一篇

猜你喜欢

热点阅读