Skip to content

Commit 30a683d

Browse files
committed
update
1 parent 372f6cf commit 30a683d

File tree

4 files changed

+31
-49
lines changed

4 files changed

+31
-49
lines changed

lib/src/cli_parser/spinner.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ class Spinner {
5252
}
5353

5454
void printAndResume(void Function(String message) print, String message) {
55-
this.stop();
55+
stop();
5656
print('[$label] $message');
57-
this.start();
57+
start();
5858
}
5959
}

lib/src/mappers_etc.dart

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ final class CollectionMapperEvent extends MapperEvent {
1616
Iterable<String> _lhashes = [];
1717
Iterable<String> _lparams = [];
1818
Iterable<String> _ltypes = [];
19-
String get args => this._largs.join(', ');
20-
String get hashes => this._lhashes.join(', ');
21-
String get params => this._lparams.join(', ');
22-
String get types => this._ltypes.join(', ');
19+
String get args => _largs.join(', ');
20+
String get hashes => _lhashes.join(', ');
21+
String get params => _lparams.join(', ');
22+
String get types => _ltypes.join(', ');
2323
}
2424

2525
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
@@ -39,10 +39,7 @@ String buildCollectionMapper(
3939
.._largs = Iterable.generate(pLength, (n) => n).map((n) => 'p$n')
4040
.._type = element[1];
4141
final argIdMatch = RegExp(r'#x(\d+)').firstMatch(output);
42-
collectionEvent._nameIndex =
43-
argIdMatch != null &&
44-
argIdMatch.groupCount >
45-
0 //
42+
collectionEvent._nameIndex = argIdMatch != null && argIdMatch.groupCount > 0 //
4643
? int.tryParse(argIdMatch.group(1)!)
4744
: null;
4845
final xHash = '#x${collectionEvent._nameIndex}';
@@ -86,8 +83,8 @@ final class ObjectMapperEvent extends MapperEvent {
8683
ObjectMapperEvent();
8784

8885
ObjectMapperEvent.custom(String name, Iterable<String> matchGroups) {
89-
this._name = name;
90-
this._matchGroups = matchGroups;
86+
_name = name;
87+
_matchGroups = matchGroups;
9188
}
9289
}
9390

@@ -103,20 +100,19 @@ String? buildObjectMapper(String type, String fieldName, TTypeMappers mappers) {
103100
/// Mapper event base class.
104101
abstract base class MapperEvent {
105102
/// The name of the field, e.g. "firstName" or "p3".
106-
String? get name =>
107-
this._name ?? (this._nameIndex != null ? 'p${this._nameIndex}' : null);
103+
String? get name => _name ?? (_nameIndex != null ? 'p$_nameIndex' : null);
108104
String? _name;
109105

110106
/// The index of the generated field name, e.g. "p3" = 3.
111-
int? get nameIndex => this._nameIndex;
107+
int? get nameIndex => _nameIndex;
112108
int? _nameIndex;
113109

114110
/// The field type, e.g. "String?".
115-
String? get type => this._type;
111+
String? get type => _type;
116112
String? _type;
117113

118114
/// Regex match groups.
119-
Iterable<String>? get matchGroups => this._matchGroups;
115+
Iterable<String>? get matchGroups => _matchGroups;
120116
Iterable<String>? _matchGroups;
121117
}
122118

@@ -160,8 +156,7 @@ TTypeMappers filterMappersByType(TTypeMappers mappers, String type) {
160156

161157
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
162158

163-
typedef TTypeMappers<E extends MapperEvent> =
164-
Map<String, String Function(E event)>;
159+
typedef TTypeMappers<E extends MapperEvent> = Map<String, String Function(E event)>;
165160

166161
TTypeMappers<T> newTypeMap<T extends MapperEvent>(
167162
Map<String, String Function(T)> src,
@@ -177,9 +172,8 @@ TTypeMappers<T> newTypeMap<T extends MapperEvent>(
177172

178173
abstract class TypeMappers {
179174
TTypeMappers<MapperEvent> get fromMappers =>
180-
{...this.collectionFromMappers, ...this.objectFromMappers}.cast();
181-
TTypeMappers<MapperEvent> get toMappers =>
182-
{...this.collectionToMappers, ...this.objectToMappers}.cast();
175+
{...collectionFromMappers, ...objectFromMappers}.cast();
176+
TTypeMappers<MapperEvent> get toMappers => {...collectionToMappers, ...objectToMappers}.cast();
183177
TTypeMappers<CollectionMapperEvent> get collectionFromMappers;
184178
TTypeMappers<CollectionMapperEvent> get collectionToMappers;
185179
TTypeMappers<ObjectMapperEvent> get objectFromMappers;

lib/src/path_explorer.dart

Lines changed: 14 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,11 @@ class PathExplorer {
5050
//
5151

5252
Stream<FilePathExplorerFinding> exploreFiles() {
53-
return explore()
54-
.where((e) => e is FilePathExplorerFinding)
55-
.cast<FilePathExplorerFinding>();
53+
return explore().where((e) => e is FilePathExplorerFinding).cast<FilePathExplorerFinding>();
5654
}
5755

5856
Stream<DirPathExplorerFinding> exploreDirs() {
59-
return explore()
60-
.where((e) => e is DirPathExplorerFinding)
61-
.cast<DirPathExplorerFinding>();
57+
return explore().where((e) => e is DirPathExplorerFinding).cast<DirPathExplorerFinding>();
6258
}
6359

6460
Stream<PathExplorerFinding> explore() async* {
@@ -73,12 +69,8 @@ class PathExplorer {
7369
final s = recurse(path, () => temp!);
7470
temp = DirPathExplorerFinding._(
7571
path: path,
76-
files: s
77-
.where((e) => e is FilePathExplorerFinding)
78-
.cast<FilePathExplorerFinding>(),
79-
dirs: s
80-
.where((e) => e is DirPathExplorerFinding)
81-
.cast<DirPathExplorerFinding>(),
72+
files: s.where((e) => e is FilePathExplorerFinding).cast<FilePathExplorerFinding>(),
73+
dirs: s.where((e) => e is DirPathExplorerFinding).cast<DirPathExplorerFinding>(),
8274
parentDir: parentDir,
8375
);
8476
yield temp;
@@ -100,9 +92,7 @@ class PathExplorer {
10092
}
10193

10294
Stream<FileData> readFiles(bool Function(FilePathExplorerFinding) filter) {
103-
return exploreFiles()
104-
.where(filter)
105-
.asyncMap(
95+
return exploreFiles().where(filter).asyncMap(
10696
(a) async => File(a.path).readAsBytes().then((b) => FileData(a, b)),
10797
);
10898
}
@@ -136,14 +126,12 @@ class PathExplorer {
136126

137127
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
138128

139-
typedef TPathExplorerFindings =
140-
Future<
141-
({
142-
Set<DirPathExplorerFinding> rootDirPathFindings,
143-
Set<DirPathExplorerFinding> dirPathFindings,
144-
Set<FilePathExplorerFinding> filePathFindings,
145-
})
146-
>;
129+
typedef TPathExplorerFindings = Future<
130+
({
131+
Set<DirPathExplorerFinding> rootDirPathFindings,
132+
Set<DirPathExplorerFinding> dirPathFindings,
133+
Set<FilePathExplorerFinding> filePathFindings,
134+
})>;
147135

148136
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
149137

@@ -165,20 +153,20 @@ final class FileReadFinding extends Equatable {
165153
//
166154
//
167155

168-
String get baseName => p.basename(this.path);
156+
String get baseName => p.basename(path);
169157

170158
//
171159
//
172160
//
173161

174-
String get rootName => this.baseName.replaceFirst(RegExp(r'\..*'), '');
162+
String get rootName => baseName.replaceFirst(RegExp(r'\..*'), '');
175163

176164
//
177165
//
178166
//
179167

180168
@override
181-
List<Object?> get props => [this.path, this.content];
169+
List<Object?> get props => [path, content];
182170
}
183171

184172
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

lib/src/placeholder_on_enum_x.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
//.title~
1212

1313
extension PlaceholderOnEnumX on Enum {
14-
String get placeholder => '___${this.name}___';
14+
String get placeholder => '___${name}___';
1515
}

0 commit comments

Comments
 (0)