@@ -29,33 +29,24 @@ class _Builder extends Builder {
29
29
/// Whether to emit a standalone (non-`part` ) file in this builder.
30
30
final bool _isStandalone;
31
31
32
- final bool _requireLibraryDirective;
33
-
34
32
final String _header;
35
33
36
34
@override
37
35
final Map <String , List <String >> buildExtensions;
38
36
39
37
/// Wrap [_generators] to form a [Builder] -compatible API.
40
- _Builder (
41
- this ._generators,
38
+ _Builder (this ._generators,
42
39
{String formatOutput (String code),
43
40
String generatedExtension: '.g.dart' ,
44
41
List <String > additionalOutputExtensions: const [],
45
42
bool isStandalone: false ,
46
- @Deprecated (
47
- 'Library directives are no longer required for part generation. '
48
- 'This option will be removed in v0.8.0.' )
49
- bool requireLibraryDirective: false ,
50
43
String header})
51
44
: _generatedExtension = generatedExtension,
52
45
buildExtensions = {
53
46
'.dart' : [generatedExtension]..addAll (additionalOutputExtensions)
54
47
},
55
48
_isStandalone = isStandalone,
56
49
formatOutput = formatOutput ?? _formatter.format,
57
- // ignore: deprecated_member_use
58
- _requireLibraryDirective = requireLibraryDirective,
59
50
_header = header ?? defaultFileHeader {
60
51
if (_generatedExtension == null ) {
61
52
throw new ArgumentError .notNull ('generatedExtension' );
@@ -106,7 +97,6 @@ class _Builder extends Builder {
106
97
var name = nameOfPartial (
107
98
library,
108
99
asset,
109
- allowUnnamedPartials: ! _requireLibraryDirective,
110
100
);
111
101
if (name == null ) {
112
102
var suggest = suggestLibraryName (asset);
@@ -126,12 +116,13 @@ class _Builder extends Builder {
126
116
}
127
117
128
118
for (var output in generatedOutputs) {
129
- contentBuffer..writeln ('' )
130
- ..writeln (_headerLine)
131
- ..writeln ('// Generator: ${output .generator }' )
132
- ..writeln (_headerLine)
133
- ..writeln ('' )
134
- ..writeln (output.output);
119
+ contentBuffer
120
+ ..writeln ('' )
121
+ ..writeln (_headerLine)
122
+ ..writeln ('// Generator: ${output .generator }' )
123
+ ..writeln (_headerLine)
124
+ ..writeln ('' )
125
+ ..writeln (output.output);
135
126
}
136
127
137
128
var genPartContent = contentBuffer.toString ();
@@ -175,32 +166,15 @@ class PartBuilder extends _Builder {
175
166
/// [header] is used to specify the content at the top of each generated file.
176
167
/// If `null` , the content of [defaultFileHeader] is used.
177
168
/// If [header] is an empty `String` no header is added.
178
- ///
179
- /// May set [requireLibraryDirective] to `true` in order to opt-out of the
180
- /// Dart `2.0.0-dev` feature of `part of` being usable without an explicit
181
- /// `library` directive. Developers should restrict their `pubspec`
182
- /// accordingly:
183
- /// ```yaml
184
- /// sdk: '>=2.0.0-dev <2.0.0'
185
- /// ```
186
- ///
187
- /// This option will be removed in version 0.8.0 of `source_gen` .
188
- PartBuilder (
189
- List <Generator > generators,
169
+ PartBuilder (List <Generator > generators,
190
170
{String formatOutput (String code),
191
171
String generatedExtension: '.g.dart' ,
192
172
List <String > additionalOutputExtensions: const [],
193
- @Deprecated (
194
- 'Library directives are no longer required for part generation. '
195
- 'This option will be removed in v0.8.0.' )
196
- bool requireLibraryDirective: false ,
197
173
String header})
198
174
: super (generators,
199
175
formatOutput: formatOutput,
200
176
generatedExtension: generatedExtension,
201
177
additionalOutputExtensions: additionalOutputExtensions,
202
- // ignore: deprecated_member_use
203
- requireLibraryDirective: requireLibraryDirective,
204
178
header: header);
205
179
}
206
180
0 commit comments