Skip to content

Commit

Permalink
## 1.2.0
Browse files Browse the repository at this point in the history
* Add smart nullable to support when data is null, set it to nullable automatically
* Support List format json
* Fix nullable checkbox not work
* Fix hive error
  • Loading branch information
zmtzawqlp committed Apr 19, 2021
1 parent 075762a commit 1df2b71
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 7 deletions.
5 changes: 5 additions & 0 deletions Flutter/json_to_dart/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 1.2.0

* Add smart nullable to support when data is null, set it to nullable automatically
* Support List format json

## 1.1.0

* Add clone method
Expand Down
7 changes: 7 additions & 0 deletions Flutter/json_to_dart/lib/models/config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ class ConfigSetting extends Setting<ConfigSetting> with ChangeNotifier {
Locale get locale => _locale;
@HiveField(12)
set locale(Locale value) {
// fix hive error
// we change zh_Hans to zh
if (value.languageCode == 'zh' && value.scriptCode == 'Hans') {
value = const Locale.fromSubtags(
languageCode: 'zh',
);
}
if (_locale != value) {
_locale = value;
notifyListeners();
Expand Down
3 changes: 3 additions & 0 deletions Flutter/json_to_dart/lib/pages/json_tree_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,9 @@ class _JsonTreeItemState extends State<JsonTreeItem> {
rowItems.add(Selector<ConfigSetting, Tuple2<bool, bool>>(
builder: (BuildContext c, Tuple2<bool, bool> value, Widget? child) {
if (ConfigSetting().nullsafety) {
if (!ConfigSetting().smartNullable) {
property.nullable = value.item2;
}
return Expanded(
flex: 1,
child: finalDepth > 0 && !widget.isArrayOject
Expand Down
12 changes: 6 additions & 6 deletions Flutter/json_to_dart/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ packages:
name: _fe_analyzer_shared
url: "https://pub.flutter-io.cn"
source: hosted
version: "19.0.0"
version: "20.0.0"
analyzer:
dependency: transitive
description:
name: analyzer
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.3.0"
version: "1.4.0"
args:
dependency: transitive
description:
Expand Down Expand Up @@ -154,7 +154,7 @@ packages:
name: crypto
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.0.0"
version: "3.0.1"
dart_style:
dependency: "direct main"
description:
Expand Down Expand Up @@ -232,7 +232,7 @@ packages:
name: hive
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.1"
version: "2.0.3"
hive_flutter:
dependency: "direct main"
description:
Expand All @@ -253,7 +253,7 @@ packages:
name: http_multi_server
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.0.0"
version: "3.0.1"
http_parser:
dependency: transitive
description:
Expand Down Expand Up @@ -442,7 +442,7 @@ packages:
name: quiver
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.0.0"
version: "3.0.1"
shelf:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion Flutter/json_to_dart/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ description: The tool to convert json to dart code.
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.1.0
version: 1.2.0

environment:
sdk: '>=2.12.0 <3.0.0'
Expand Down

0 comments on commit 1df2b71

Please sign in to comment.