Skip to content

Commit b6efc8f

Browse files
committed
* update json_to_dart_library
1 parent 317a874 commit b6efc8f

File tree

7 files changed

+37
-52
lines changed

7 files changed

+37
-52
lines changed

Flutter/json_to_dart/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.0.4
2+
3+
* update json_to_dart_library
4+
15
## 2.0.3
26

37
* Support json_schema

Flutter/json_to_dart/lib/l10n/app_localizations.dart

Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,15 @@ import 'app_localizations_zh.dart';
6262
/// be consistent with the languages listed in the AppLocalizations.supportedLocales
6363
/// property.
6464
abstract class AppLocalizations {
65-
AppLocalizations(String locale)
66-
: localeName = intl.Intl.canonicalizedLocale(locale.toString());
65+
AppLocalizations(String locale) : localeName = intl.Intl.canonicalizedLocale(locale.toString());
6766

6867
final String localeName;
6968

7069
static AppLocalizations? of(BuildContext context) {
7170
return Localizations.of<AppLocalizations>(context, AppLocalizations);
7271
}
7372

74-
static const LocalizationsDelegate<AppLocalizations> delegate =
75-
_AppLocalizationsDelegate();
73+
static const LocalizationsDelegate<AppLocalizations> delegate = _AppLocalizationsDelegate();
7674

7775
/// A list of this localizations delegate along with the default localizations
7876
/// delegates.
@@ -84,8 +82,7 @@ abstract class AppLocalizations {
8482
/// Additional delegates can be added by appending to this list in
8583
/// MaterialApp. This list does not have to be used at all if a custom list
8684
/// of delegates is preferred or required.
87-
static const List<LocalizationsDelegate<dynamic>> localizationsDelegates =
88-
<LocalizationsDelegate<dynamic>>[
85+
static const List<LocalizationsDelegate<dynamic>> localizationsDelegates = <LocalizationsDelegate<dynamic>>[
8986
delegate,
9087
GlobalMaterialLocalizations.delegate,
9188
GlobalCupertinoLocalizations.delegate,
@@ -394,8 +391,7 @@ abstract class AppLocalizations {
394391
String get deepCopy;
395392
}
396393

397-
class _AppLocalizationsDelegate
398-
extends LocalizationsDelegate<AppLocalizations> {
394+
class _AppLocalizationsDelegate extends LocalizationsDelegate<AppLocalizations> {
399395
const _AppLocalizationsDelegate();
400396

401397
@override
@@ -404,37 +400,34 @@ class _AppLocalizationsDelegate
404400
}
405401

406402
@override
407-
bool isSupported(Locale locale) =>
408-
<String>['en', 'zh'].contains(locale.languageCode);
403+
bool isSupported(Locale locale) => <String>['en', 'zh'].contains(locale.languageCode);
409404

410405
@override
411406
bool shouldReload(_AppLocalizationsDelegate old) => false;
412407
}
413408

414409
AppLocalizations lookupAppLocalizations(Locale locale) {
410+
415411
// Lookup logic when language+script codes are specified.
416412
switch (locale.languageCode) {
417-
case 'zh':
418-
{
419-
switch (locale.scriptCode) {
420-
case 'Hant':
421-
return AppLocalizationsZhHant();
422-
}
423-
break;
424-
}
413+
case 'zh': {
414+
switch (locale.scriptCode) {
415+
case 'Hant': return AppLocalizationsZhHant();
416+
}
417+
break;
418+
}
425419
}
426420

427421
// Lookup logic when only language code is specified.
428422
switch (locale.languageCode) {
429-
case 'en':
430-
return AppLocalizationsEn();
431-
case 'zh':
432-
return AppLocalizationsZh();
423+
case 'en': return AppLocalizationsEn();
424+
case 'zh': return AppLocalizationsZh();
433425
}
434426

435427
throw FlutterError(
436-
'AppLocalizations.delegate failed to load unsupported locale "$locale". This is likely '
437-
'an issue with the localizations generation tool. Please file an issue '
438-
'on GitHub with a reproducible sample app and the gen-l10n configuration '
439-
'that was used.');
428+
'AppLocalizations.delegate failed to load unsupported locale "$locale". This is likely '
429+
'an issue with the localizations generation tool. Please file an issue '
430+
'on GitHub with a reproducible sample app and the gen-l10n configuration '
431+
'that was used.'
432+
);
440433
}

Flutter/json_to_dart/lib/l10n/app_localizations_en.dart

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// ignore: unused_import
2-
import 'package:intl/intl.dart' as intl;
31
import 'app_localizations.dart';
42

53
// ignore_for_file: type=lint
@@ -28,8 +26,7 @@ class AppLocalizationsEn extends AppLocalizations {
2826
}
2927

3028
@override
31-
String get formatErrorInfo =>
32-
'There is something wrong to format. The error has copied into Clipboard.';
29+
String get formatErrorInfo => 'There is something wrong to format. The error has copied into Clipboard.';
3330

3431
@override
3532
String get illegalJson => 'Illegal JSON format';
@@ -38,16 +35,13 @@ class AppLocalizationsEn extends AppLocalizations {
3835
String get timeFormatError => 'The format of time is not right.';
3936

4037
@override
41-
String get generateSucceed =>
42-
'The dart code is generated successfully. It has copied into Clipboard.';
38+
String get generateSucceed => 'The dart code is generated successfully. It has copied into Clipboard.';
4339

4440
@override
45-
String get generateFailed =>
46-
'The dart code is generated failed. The error has copied into Clipboard.';
41+
String get generateFailed => 'The dart code is generated failed. The error has copied into Clipboard.';
4742

4843
@override
49-
String get inputHelp =>
50-
'Please input your json string, and click Format button.';
44+
String get inputHelp => 'Please input your json string, and click Format button.';
5145

5246
@override
5347
String get type => 'Type';
@@ -95,8 +89,7 @@ class AppLocalizationsEn extends AppLocalizations {
9589
String get fileHeader => 'File Header';
9690

9791
@override
98-
String get fileHeaderHelp =>
99-
'You can add copyright,dart code, creator into here. support [Date yyyy MM-dd] format to generate time.';
92+
String get fileHeaderHelp => 'You can add copyright,dart code, creator into here. support [Date yyyy MM-dd] format to generate time.';
10093

10194
@override
10295
String get nullsafety => 'Null Safety';
@@ -120,8 +113,7 @@ class AppLocalizationsEn extends AppLocalizations {
120113
String get ok => 'OK';
121114

122115
@override
123-
String get propertyCantSameAsClassName =>
124-
'property can\'t the same as Class name';
116+
String get propertyCantSameAsClassName => 'property can\'t the same as Class name';
125117

126118
@override
127119
String keywordCheckFailed(Object name) {

Flutter/json_to_dart/lib/l10n/app_localizations_zh.dart

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// ignore: unused_import
2-
import 'package:intl/intl.dart' as intl;
31
import 'app_localizations.dart';
42

53
// ignore_for_file: type=lint
@@ -91,8 +89,7 @@ class AppLocalizationsZh extends AppLocalizations {
9189
String get fileHeader => '文件头信息';
9290

9391
@override
94-
String get fileHeaderHelp =>
95-
'可以在这里添加 Copyright,导入 Dart 代码,创建人信息等等。支持[Date yyyy MM-dd]来生成时间,Date后面为日期格式.';
92+
String get fileHeaderHelp => '可以在这里添加 Copyright,导入 Dart 代码,创建人信息等等。支持[Date yyyy MM-dd]来生成时间,Date后面为日期格式.';
9693

9794
@override
9895
String get nullsafety => '空安全';
@@ -165,7 +162,7 @@ class AppLocalizationsZh extends AppLocalizations {
165162

166163
/// The translations for Chinese, using the Han script (`zh_Hant`).
167164
class AppLocalizationsZhHant extends AppLocalizationsZh {
168-
AppLocalizationsZhHant() : super('zh_Hant');
165+
AppLocalizationsZhHant(): super('zh_Hant');
169166

170167
@override
171168
String get formatButtonLabel => '格式化';
@@ -250,8 +247,7 @@ class AppLocalizationsZhHant extends AppLocalizationsZh {
250247
String get fileHeader => '文件头信息';
251248

252249
@override
253-
String get fileHeaderHelp =>
254-
'可以在這裏添加 Copyright,導入 Dart 代碼,創建人資訊等等。支持[Date yyyy MM-dd]來生成時間,Date後面為日期格式。';
250+
String get fileHeaderHelp => '可以在這裏添加 Copyright,導入 Dart 代碼,創建人資訊等等。支持[Date yyyy MM-dd]來生成時間,Date後面為日期格式。';
255251

256252
@override
257253
String get nullsafety => '空安全';

Flutter/json_to_dart/lib/main_controller.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
99
import 'package:flutter_spinkit/flutter_spinkit.dart';
1010
import 'package:get/get.dart';
1111
import 'package:intl/intl.dart';
12-
import 'package:json_to_dart/l10n/app_localizations.dart';
1312
import 'package:json_schema/json_schema.dart';
13+
import 'package:json_to_dart/l10n/app_localizations.dart';
1414
import 'package:json_to_dart_library/json_to_dart_library.dart' hide StringE;
1515

1616
import 'models/config.dart';

Flutter/json_to_dart/pubspec.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,10 +441,10 @@ packages:
441441
dependency: "direct main"
442442
description:
443443
name: json_to_dart_library
444-
sha256: "28522d55035b2a1a569746d31bdc1775db690e3a04561d83bbebba258f1ad5b7"
444+
sha256: b362e10ba4c3522b587656078bb3c7596a5dbca1d3d79698c5c57fb466e5473f
445445
url: "https://pub.flutter-io.cn"
446446
source: hosted
447-
version: "0.0.6"
447+
version: "0.0.7"
448448
leak_tracker:
449449
dependency: transitive
450450
description:

Flutter/json_to_dart/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ description: The tool to convert json to dart code.
1111
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
1212
# Read more about iOS versioning at
1313
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
14-
version: 2.0.3
14+
version: 2.0.4
1515

1616
environment:
1717
sdk: ">=3.5.0 <4.0.0"
@@ -34,7 +34,7 @@ dependencies:
3434

3535
hive: any
3636
hive_flutter: any
37-
json_to_dart_library: ^0.0.6
37+
json_to_dart_library: ^0.0.7
3838
nested: any
3939

4040
dependency_overrides:

0 commit comments

Comments
 (0)