2
2
// for details. All rights reserved. Use of this source code is governed by a
3
3
// BSD-style license that can be found in the LICENSE file.
4
4
5
- import 'dart:core' ;
6
-
7
5
import 'package:analyzer/dart/element/element2.dart' ;
8
6
import 'package:analyzer/dart/element/nullability_suffix.dart' ;
9
7
import 'package:build/build.dart' ;
@@ -86,22 +84,18 @@ mixin DecodeHelper implements HelperCore {
86
84
/// If [functionBodyParts] has only one element, expression body is used.
87
85
///
88
86
/// ```dart
89
- /// '''
90
87
/// ExampleClass _$ExampleClassFromJson(Map<String, dynamic> json) =>
91
88
/// /* only body part here */
92
- /// '''
93
89
/// ```
94
90
///
95
91
/// If [functionBodyParts] has more than one element, block body is used.
96
92
///
97
93
/// ```dart
98
- /// '''
99
94
/// ExampleClass _$ExampleClassFromJson(Map<String, dynamic> json) {
100
95
/// /* first body parts here */
101
96
///
102
97
/// return /* last body part here */;
103
98
/// }
104
- /// '''
105
99
/// ```
106
100
String _createFromJsonFunctionSignature (Iterable <String > functionBodyParts) {
107
101
final mapType = config.anyMap ? 'Map' : 'Map<String, dynamic>' ;
@@ -145,13 +139,11 @@ mixin DecodeHelper implements HelperCore {
145
139
///
146
140
/// For example:
147
141
/// ```dart
148
- /// '''
149
142
/// switch (json['type']) {
150
143
/// 'FirstSubtype' => _$FirstSubtypeFromJson(json),
151
144
/// 'SecondSubtype' => _$SecondSubtypeFromJson(json),
152
145
/// _ => throw Exception('Unknown type: ${json['type']}'),
153
146
/// };
154
- /// '''
155
147
/// ```
156
148
String _createSealedFunctionExpressionBody () {
157
149
assert (element.isSealed);
@@ -185,7 +177,6 @@ _ => throw UnrecognizedUnionTypeException(
185
177
///
186
178
/// For example:
187
179
/// ```dart
188
- /// '''
189
180
/// $checkedCreate(
190
181
/// 'FirstSubtype',
191
182
/// json,
@@ -201,7 +192,6 @@ _ => throw UnrecognizedUnionTypeException(
201
192
/// return val;
202
193
/// },
203
194
/// );
204
- /// '''
205
195
/// ```
206
196
String _createCheckedFunctionExpressionBody (
207
197
_ConstructorData data,
@@ -268,39 +258,31 @@ _ => throw UnrecognizedUnionTypeException(
268
258
///
269
259
/// ```dart
270
260
/// [
271
- /// '''
272
261
/// ExampleClass(
273
262
/// json['exampleField'] as String,
274
263
/// )
275
- /// '''
276
264
/// ]
277
265
/// /* OR with fields to set */
278
266
/// [
279
- /// '''
280
267
/// ExampleClass(
281
268
/// json['exampleField'] as String,
282
269
/// )
283
270
/// ..field1 = json['field1'] as String
284
- /// ..field2 = json['field2'] as String;
285
- /// '''
271
+ /// ..field2 = json['field2'] as String
286
272
/// ]
287
273
/// ```
288
274
///
289
275
/// If there are checks, will return the checks followed by the
290
276
/// constructor invocation.
291
277
/// ```dart
292
278
/// [
293
- /// '''
294
279
/// $checkKeys(
295
280
/// json,
296
281
/// allowedKeys: const ['exampleField', 'field1', 'field2'],
297
- /// )
298
- /// ''',
299
- /// '''
282
+ /// ),
300
283
/// ExampleClass(
301
284
/// json['exampleField'] as String,
302
285
/// )
303
- /// '''
304
286
/// ]
305
287
/// ```
306
288
///
0 commit comments