Skip to content

Commit a909e8e

Browse files
committed
+Update dependencies
1 parent f68c25c commit a909e8e

File tree

6 files changed

+52
-55
lines changed

6 files changed

+52
-55
lines changed

README.md

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
1-
<a href="https://www.buymeacoffee.com/dev_cetera" target="_blank"><img align="right" src="https://cdn.buymeacoffee.com/buttons/default-orange.png" height="48"></a>
2-
<a href="https://discord.gg/gEQ8y2nfyX" target="_blank"><img align="right" src="https://raw.githubusercontent.com/dev-cetera/.github/refs/heads/main/assets/icons/discord_icon/discord_icon.svg" height="48"></a>
1+
[![banner](https://github.com/dev-cetera/df_generate_dart_models/blob/v0.14.2/doc/assets/banner.png?raw=true)](https://github.com/dev-cetera)
32

4-
Dart & Flutter Packages by dev-cetera.com & contributors.
5-
6-
[![sponsor](https://img.shields.io/badge/sponsor-grey?logo=github-sponsors)](https://github.com/sponsors/dev-cetera)
7-
[![patreon](https://img.shields.io/badge/patreon-grey?logo=patreon)](https://www.patreon.com/c/RobertMollentze)
83
[![pub](https://img.shields.io/pub/v/df_generate_dart_models.svg)](https://pub.dev/packages/df_generate_dart_models)
9-
[![tag](https://img.shields.io/badge/tag-v0.14.2-purple?logo=github)](https://github.com/dev-cetera/df_generate_dart_models/tree/v0.14.2)
10-
[![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/dev-cetera/df_generate_dart_models/main/LICENSE)
4+
[![tag](https://img.shields.io/badge/Tag-v0.14.2-purple?logo=github)](https://github.com/dev-cetera/df_generate_dart_models/tree/v0.14.2)
5+
[![buymeacoffee](https://img.shields.io/badge/Buy%20Me%20A%20Coffee-FFDD00?logo=buy-me-a-coffee&logoColor=black)](https://www.buymeacoffee.com/dev_cetera)
6+
[![sponsor](https://img.shields.io/badge/Sponsor-grey?logo=github-sponsors&logoColor=pink)](https://github.com/sponsors/dev-cetera)
7+
[![patreon](https://img.shields.io/badge/Patreon-grey?logo=patreon)](https://www.patreon.com/robelator)
8+
[![discord](https://img.shields.io/badge/Discord-5865F2?logo=discord&logoColor=white)](https://discord.gg/gEQ8y2nfyX)
9+
[![instagram](https://img.shields.io/badge/Instagram-E4405F?logo=instagram&logoColor=white)](https://www.instagram.com/dev_cetera/)
10+
[![license](https://img.shields.io/badge/License-MIT-blue.svg)](https://raw.githubusercontent.com/dev-cetera/df_generate_dart_models/main/LICENSE)
1111

1212
---
1313

14-
[![banner](https://github.com/dev-cetera/df_safer_dart/blob/v0.14.2/doc/assets/banner.png?raw=true)](https://github.com/dev-cetera)
15-
1614
<!-- BEGIN _README_CONTENT -->
1715

1816
A tool for generating data models and classes from annotations, offering greater flexibility than json_serializable or freezed. It supports generating classes from template files for enhanced customization, ensures stronger type safety, and includes intelligent conversion mechanisms.
@@ -94,12 +92,11 @@ Save the file somewhere in its own directory, for example `lib/models/model_user
9492
2. In your project, open a terminal at the desired folder, e.g. `cd lib/models/model_user/model_user.dart`.
9593
3. Run `--models-min`. This will generate the `_model_user.g.dart` file in the same directory.
9694

97-
9895
<!-- END _README_CONTENT -->
9996

10097
---
10198

102-
☝️ Please refer to the [API reference](https://pub.dev/documentation/df_generate_dart_models/) for more information.
99+
🔍 For more information, refer to the [API reference](https://pub.dev/documentation/df_generate_dart_models/).
103100

104101
---
105102

@@ -109,7 +106,6 @@ This is an open-source project, and we warmly welcome contributions from everyon
109106

110107
### ☝️ Ways you can contribute
111108

112-
- **Buy me a coffee:** If you'd like to support the project financially, consider [buying me a coffee](https://www.buymeacoffee.com/dev_cetera). Your support helps cover the costs of development and keeps the project growing.
113109
- **Find us on Discord:** Feel free to ask questions and engage with the community here: https://discord.gg/gEQ8y2nfyX.
114110
- **Share your ideas:** Every perspective matters, and your ideas can spark innovation.
115111
- **Help others:** Engage with other users by offering advice, solutions, or troubleshooting assistance.
@@ -126,7 +122,6 @@ If you're enjoying this package and find it valuable, consider showing your appr
126122

127123
<a href="https://www.buymeacoffee.com/dev_cetera" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" height="40"></a>
128124

129-
## 🧑‍⚖️ License
125+
## LICENSE
130126

131127
This project is released under the [MIT License](https://raw.githubusercontent.com/dev-cetera/df_generate_dart_models/main/LICENSE). See [LICENSE](https://raw.githubusercontent.com/dev-cetera/df_generate_dart_models/main/LICENSE) for more information.
132-

analysis_options.yaml

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
1-
##.title
2-
## ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
3-
##
4-
## Copyright © dev-cetera.com & contributors.
5-
##
6-
## The use of this source code is governed by an MIT-style license described in
7-
## the LICENSE file located in this project's root directory.
8-
##
9-
## See: https://opensource.org/license/mit
10-
##
11-
## ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
12-
##.title~
1+
# For dev-cetera.com
2+
# Version: 1
133

144
include: package:lints/recommended.yaml
155

@@ -31,6 +21,7 @@ linter:
3121
prefer_relative_imports: true
3222
prefer_single_quotes: true
3323
require_trailing_commas: true
24+
unawaited_futures: true
3425
unnecessary_this: true
3526

3627
analyzer:
@@ -42,21 +33,26 @@ analyzer:
4233
strict-raw-types: true
4334
exclude:
4435
- build/**
36+
# - '**.g.dart'
4537

4638
errors:
47-
unused_label: ignore
4839
always_declare_return_types: error
4940
avoid_renaming_method_parameters: error
5041
avoid_type_to_string: error
42+
close_sinks: error
43+
collection_methods_unrelated_type: error
5144
depend_on_referenced_packages: error
5245
flutter_style_todos: error
5346
invalid_override_of_non_virtual_member: error
5447
invalid_use_of_protected_member: error
48+
missing_return: error
5549
no_leading_underscores_for_local_identifiers: error
5650
prefer_final_in_for_each: error
5751
prefer_relative_imports: error
52+
record_literal_one_positional_no_trailing_comma: error
5853
unnecessary_new: error
5954
unrelated_type_equality_checks: error
55+
unused_label: ignore
6056
use_key_in_widget_constructors: error
6157

6258
formatter:

bin/analysis_options.yaml

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
1-
##.title
2-
## ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
3-
##
4-
## Copyright © dev-cetera.com & contributors.
5-
##
6-
## The use of this source code is governed by an MIT-style license described in
7-
## the LICENSE file located in this project's root directory.
8-
##
9-
## See: https://opensource.org/license/mit
10-
##
11-
## ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
12-
##.title~
1+
# For dev-cetera.com
2+
# Version: 1
133

144
include: package:lints/recommended.yaml
155

@@ -31,6 +21,7 @@ linter:
3121
prefer_relative_imports: true
3222
prefer_single_quotes: true
3323
require_trailing_commas: true
24+
unawaited_futures: true
3425
unnecessary_this: true
3526

3627
analyzer:
@@ -42,21 +33,26 @@ analyzer:
4233
strict-raw-types: true
4334
exclude:
4435
- build/**
36+
# - '**.g.dart'
4537

4638
errors:
47-
unused_label: ignore
4839
always_declare_return_types: error
4940
avoid_renaming_method_parameters: error
5041
avoid_type_to_string: error
42+
close_sinks: error
43+
collection_methods_unrelated_type: error
5144
depend_on_referenced_packages: error
5245
flutter_style_todos: error
5346
invalid_override_of_non_virtual_member: error
5447
invalid_use_of_protected_member: error
48+
missing_return: error
5549
no_leading_underscores_for_local_identifiers: error
5650
prefer_final_in_for_each: error
5751
prefer_relative_imports: error
52+
record_literal_one_positional_no_trailing_comma: error
5853
unnecessary_new: error
5954
unrelated_type_equality_checks: error
55+
unused_label: ignore
6056
use_key_in_widget_constructors: error
6157

6258
formatter:

bin/pubspec.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@ name: generate_dart_models
1515
homepage: https://dev-cetera.com/
1616
repository: https://github.com/robmllze/df_generate_dart_models
1717
funding:
18+
- https://www.patreon.com/c/robelator
19+
- https://github.com/sponsors/robelator
1820
- https://www.buymeacoffee.com/dev_cetera
19-
- https://www.patreon.com/c/RobertMollentze
20-
- https://github.com/sponsors/robmllze
21+
22+
2123
publish_to: none
2224

2325
## -----------------------------------------------------------------------------

lib/src/generate_dart_models.dart

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,12 @@ Future<void> generateDartModels(
7979
}
8080
final analysisContextCollection = createDartAnalysisContextCollection(
8181
{inputPath},
82-
dartSdk, //
82+
dartSdk,
8383
);
8484
Log.printWhite('Reading template at: $templatePathOrUrl...');
85-
final result = await MdTemplateUtility.i.readTemplateFromPathOrUrl(templatePathOrUrl).value;
85+
final result = await MdTemplateUtility.i
86+
.readTemplateFromPathOrUrl(templatePathOrUrl)
87+
.value;
8688
if (result.isErr()) {
8789
Log.printRed(' Failed to read template!');
8890
exit(ExitCodes.FAILURE.code);
@@ -150,16 +152,20 @@ bool _isAllowedFileName(String e) {
150152

151153
final _interpolator = TemplateInterpolator<ClassInsight<GenerateDartModel>>({
152154
'___DESCRIPTION___': (insight) {
153-
return insight.annotation.description ?? 'Generated class for [${insight.className}].';
155+
return insight.annotation.description ??
156+
'Generated class for [${insight.className}].';
154157
},
155158
'___SUPER_CLASS_NAME___': (insight) {
156-
return insight.annotation.shouldInherit == true ? insight.className : 'Model';
159+
return insight.annotation.shouldInherit == true
160+
? insight.className
161+
: 'Model';
157162
},
158163
'___CLASS_FILE_NAME___': (insight) {
159164
return insight.fileName;
160165
},
161166
'___CLASS_NAME___': (insight) {
162-
return insight.annotation.className ?? insight.className.replaceFirst(RegExp(r'^[_$]+'), '');
167+
return insight.annotation.className ??
168+
insight.className.replaceFirst(RegExp(r'^[_$]+'), '');
163169
},
164170
'___SUPER_CONSTRUCTOR___': (insight) {
165171
return insight.annotation.shouldInherit == true
@@ -233,7 +239,8 @@ final _interpolator = TemplateInterpolator<ClassInsight<GenerateDartModel>>({
233239
final j = fields.map((a) {
234240
final ff = fields
235241
.where(
236-
(b) => a.fieldPath!.join('.').startsWith('${b.fieldPath!.join('.')}.'),
242+
(b) =>
243+
a.fieldPath!.join('.').startsWith('${b.fieldPath!.join('.')}.'),
237244
)
238245
.toList();
239246
ff.sort((a, b) => b.fieldName!.compareTo(a.fieldName!));
@@ -325,8 +332,8 @@ final _interpolator = TemplateInterpolator<ClassInsight<GenerateDartModel>>({
325332
},
326333
'___FIELD_NAMES___': (insight) {
327334
return insight.fields.map((e) {
328-
final className =
329-
insight.annotation.className ?? insight.className.replaceFirst(RegExp(r'^[_$]+'), '');
335+
final className = insight.annotation.className ??
336+
insight.className.replaceFirst(RegExp(r'^[_$]+'), '');
330337
final f = e.fieldName;
331338
final c = insight.stringCaseType.convert(e.fieldName!);
332339
return [
@@ -374,6 +381,7 @@ extension _ClassInsightExtension on ClassInsight<GenerateDartModel> {
374381
}
375382

376383
StringCaseType get stringCaseType {
377-
return StringCaseType.values.valueOf(annotation.keyStringCase) ?? StringCaseType.CAMEL_CASE;
384+
return StringCaseType.values.valueOf(annotation.keyStringCase) ??
385+
StringCaseType.CAMEL_CASE;
378386
}
379387
}

pubspec.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ name: df_generate_dart_models
1515
homepage: https://dev-cetera.com/
1616
repository: https://github.com/robmllze/df_generate_dart_models
1717
funding:
18+
- https://www.patreon.com/c/robelator
19+
- https://github.com/sponsors/robelator
1820
- https://www.buymeacoffee.com/dev_cetera
19-
- https://www.patreon.com/c/RobertMollentze
20-
- https://github.com/sponsors/robmllze
2121
description: A tool for generating data models and classes from annotations, offering greater flexibility than json_serializable or freezed.
2222
version: 0.14.2
2323
topics:
@@ -43,7 +43,7 @@ dependencies:
4343
df_gen_core: ^0.7.0
4444
df_generate_dart_models_core: ^0.9.22
4545
df_log: ^0.3.20
46-
df_string: ^0.2.9
46+
df_string: ^0.2.10
4747
df_type: ^0.14.2
4848

4949
## -----------------------------------------------------------------------------

0 commit comments

Comments
 (0)