diff --git a/Flutter/json_to_dart/CHANGELOG.md b/Flutter/json_to_dart/CHANGELOG.md index 09e76e3..d459d1b 100644 --- a/Flutter/json_to_dart/CHANGELOG.md +++ b/Flutter/json_to_dart/CHANGELOG.md @@ -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 diff --git a/Flutter/json_to_dart/lib/models/config.dart b/Flutter/json_to_dart/lib/models/config.dart index 8a39410..91011b8 100644 --- a/Flutter/json_to_dart/lib/models/config.dart +++ b/Flutter/json_to_dart/lib/models/config.dart @@ -85,6 +85,13 @@ class ConfigSetting extends Setting 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(); diff --git a/Flutter/json_to_dart/lib/pages/json_tree_item.dart b/Flutter/json_to_dart/lib/pages/json_tree_item.dart index 5e38021..9970f33 100644 --- a/Flutter/json_to_dart/lib/pages/json_tree_item.dart +++ b/Flutter/json_to_dart/lib/pages/json_tree_item.dart @@ -198,6 +198,9 @@ class _JsonTreeItemState extends State { rowItems.add(Selector>( builder: (BuildContext c, Tuple2 value, Widget? child) { if (ConfigSetting().nullsafety) { + if (!ConfigSetting().smartNullable) { + property.nullable = value.item2; + } return Expanded( flex: 1, child: finalDepth > 0 && !widget.isArrayOject diff --git a/Flutter/json_to_dart/pubspec.lock b/Flutter/json_to_dart/pubspec.lock index b9edd54..edd4f23 100644 --- a/Flutter/json_to_dart/pubspec.lock +++ b/Flutter/json_to_dart/pubspec.lock @@ -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: @@ -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: @@ -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: @@ -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: @@ -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: diff --git a/Flutter/json_to_dart/pubspec.yaml b/Flutter/json_to_dart/pubspec.yaml index 1d60bf7..d57dec6 100644 --- a/Flutter/json_to_dart/pubspec.yaml +++ b/Flutter/json_to_dart/pubspec.yaml @@ -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'