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/element.dart' ;
8
6
import 'package:analyzer/dart/element/nullability_suffix.dart' ;
9
7
import 'package:build/build.dart' ;
@@ -93,22 +91,18 @@ mixin DecodeHelper implements HelperCore {
93
91
/// If [functionBodyParts] has only one element, expression body is used.
94
92
///
95
93
/// ```dart
96
- /// '''
97
94
/// ExampleClass _$ExampleClassFromJson(Map<String, dynamic> json) =>
98
95
/// /* only body part here */
99
- /// '''
100
96
/// ```
101
97
///
102
98
/// If [functionBodyParts] has more than one element, block body is used.
103
99
///
104
100
/// ```dart
105
- /// '''
106
101
/// ExampleClass _$ExampleClassFromJson(Map<String, dynamic> json) {
107
102
/// /* first body parts here */
108
103
///
109
104
/// return /* last body part here */;
110
105
/// }
111
- /// '''
112
106
/// ```
113
107
String _createFromJsonFunctionSignature (Iterable <String > functionBodyParts) {
114
108
final mapType = config.anyMap ? 'Map' : 'Map<String, dynamic>' ;
@@ -150,13 +144,11 @@ mixin DecodeHelper implements HelperCore {
150
144
///
151
145
/// For example:
152
146
/// ```dart
153
- /// '''
154
147
/// switch (json['type']) {
155
148
/// 'FirstSubtype' => _$FirstSubtypeFromJson(json),
156
149
/// 'SecondSubtype' => _$SecondSubtypeFromJson(json),
157
150
/// _ => throw Exception('Unknown type: ${json['type']}'),
158
151
/// };
159
- /// '''
160
152
/// ```
161
153
String _createSealedFunctionExpressionBody () {
162
154
assert (element.isSealed);
@@ -195,7 +187,6 @@ _ => throw UnrecognizedUnionTypeException(
195
187
///
196
188
/// For example:
197
189
/// ```dart
198
- /// '''
199
190
/// $checkedCreate(
200
191
/// 'FirstSubtype',
201
192
/// json,
@@ -211,7 +202,6 @@ _ => throw UnrecognizedUnionTypeException(
211
202
/// return val;
212
203
/// },
213
204
/// );
214
- /// '''
215
205
/// ```
216
206
String _createCheckedFunctionExpressionBody (
217
207
_ConstructorData data,
@@ -278,39 +268,31 @@ _ => throw UnrecognizedUnionTypeException(
278
268
///
279
269
/// ```dart
280
270
/// [
281
- /// '''
282
271
/// ExampleClass(
283
272
/// json['exampleField'] as String,
284
273
/// )
285
- /// '''
286
274
/// ]
287
275
/// /* OR with fields to set */
288
276
/// [
289
- /// '''
290
277
/// ExampleClass(
291
278
/// json['exampleField'] as String,
292
279
/// )
293
280
/// ..field1 = json['field1'] as String
294
- /// ..field2 = json['field2'] as String;
295
- /// '''
281
+ /// ..field2 = json['field2'] as String
296
282
/// ]
297
283
/// ```
298
284
///
299
285
/// If there are checks, will return the checks followed by the
300
286
/// constructor invocation.
301
287
/// ```dart
302
288
/// [
303
- /// '''
304
289
/// $checkKeys(
305
290
/// json,
306
291
/// allowedKeys: const ['exampleField', 'field1', 'field2'],
307
- /// )
308
- /// ''',
309
- /// '''
292
+ /// ),
310
293
/// ExampleClass(
311
294
/// json['exampleField'] as String,
312
295
/// )
313
- /// '''
314
296
/// ]
315
297
/// ```
316
298
///
0 commit comments