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' ;
@@ -79,22 +77,18 @@ mixin DecodeHelper implements HelperCore {
79
77
/// If [functionBodyParts] has only one element, expression body is used.
80
78
///
81
79
/// ```dart
82
- /// '''
83
80
/// ExampleClass _$ExampleClassFromJson(Map<String, dynamic> json) =>
84
81
/// /* only body part here */
85
- /// '''
86
82
/// ```
87
83
///
88
84
/// If [functionBodyParts] has more than one element, block body is used.
89
85
///
90
86
/// ```dart
91
- /// '''
92
87
/// ExampleClass _$ExampleClassFromJson(Map<String, dynamic> json) {
93
88
/// /* first body parts here */
94
89
///
95
90
/// return /* last body part here */;
96
91
/// }
97
- /// '''
98
92
/// ```
99
93
String _createFromJsonFunctionSignature (Iterable <String > functionBodyParts) {
100
94
final mapType = config.anyMap ? 'Map' : 'Map<String, dynamic>' ;
@@ -138,13 +132,11 @@ mixin DecodeHelper implements HelperCore {
138
132
///
139
133
/// For example:
140
134
/// ```dart
141
- /// '''
142
135
/// switch (json['type']) {
143
136
/// 'FirstSubtype' => _$FirstSubtypeFromJson(json),
144
137
/// 'SecondSubtype' => _$SecondSubtypeFromJson(json),
145
138
/// _ => throw Exception('Unknown type: ${json['type']}'),
146
139
/// };
147
- /// '''
148
140
/// ```
149
141
String _createSealedFunctionExpressionBody () {
150
142
assert (element.isSealed);
@@ -178,7 +170,6 @@ _ => throw UnrecognizedUnionTypeException(
178
170
///
179
171
/// For example:
180
172
/// ```dart
181
- /// '''
182
173
/// $checkedCreate(
183
174
/// 'FirstSubtype',
184
175
/// json,
@@ -194,7 +185,6 @@ _ => throw UnrecognizedUnionTypeException(
194
185
/// return val;
195
186
/// },
196
187
/// );
197
- /// '''
198
188
/// ```
199
189
String _createCheckedFunctionExpressionBody (
200
190
_ConstructorData data,
@@ -261,39 +251,31 @@ _ => throw UnrecognizedUnionTypeException(
261
251
///
262
252
/// ```dart
263
253
/// [
264
- /// '''
265
254
/// ExampleClass(
266
255
/// json['exampleField'] as String,
267
256
/// )
268
- /// '''
269
257
/// ]
270
258
/// /* OR with fields to set */
271
259
/// [
272
- /// '''
273
260
/// ExampleClass(
274
261
/// json['exampleField'] as String,
275
262
/// )
276
263
/// ..field1 = json['field1'] as String
277
- /// ..field2 = json['field2'] as String;
278
- /// '''
264
+ /// ..field2 = json['field2'] as String
279
265
/// ]
280
266
/// ```
281
267
///
282
268
/// If there are checks, will return the checks followed by the
283
269
/// constructor invocation.
284
270
/// ```dart
285
271
/// [
286
- /// '''
287
272
/// $checkKeys(
288
273
/// json,
289
274
/// allowedKeys: const ['exampleField', 'field1', 'field2'],
290
- /// )
291
- /// ''',
292
- /// '''
275
+ /// ),
293
276
/// ExampleClass(
294
277
/// json['exampleField'] as String,
295
278
/// )
296
- /// '''
297
279
/// ]
298
280
/// ```
299
281
///
0 commit comments