22// for details. All rights reserved. Use of this source code is governed by a
33// BSD-style license that can be found in the LICENSE file.
44
5- import 'dart:core' ;
6-
75import 'package:analyzer/dart/element/element.dart' ;
86import 'package:analyzer/dart/element/nullability_suffix.dart' ;
97import 'package:build/build.dart' ;
@@ -93,22 +91,18 @@ mixin DecodeHelper implements HelperCore {
9391 /// If [functionBodyParts] has only one element, expression body is used.
9492 ///
9593 /// ```dart
96- /// '''
9794 /// ExampleClass _$ExampleClassFromJson(Map<String, dynamic> json) =>
9895 /// /* only body part here */
99- /// '''
10096 /// ```
10197 ///
10298 /// If [functionBodyParts] has more than one element, block body is used.
10399 ///
104100 /// ```dart
105- /// '''
106101 /// ExampleClass _$ExampleClassFromJson(Map<String, dynamic> json) {
107102 /// /* first body parts here */
108103 ///
109104 /// return /* last body part here */;
110105 /// }
111- /// '''
112106 /// ```
113107 String _createFromJsonFunctionSignature (Iterable <String > functionBodyParts) {
114108 final mapType = config.anyMap ? 'Map' : 'Map<String, dynamic>' ;
@@ -150,13 +144,11 @@ mixin DecodeHelper implements HelperCore {
150144 ///
151145 /// For example:
152146 /// ```dart
153- /// '''
154147 /// switch (json['type']) {
155148 /// 'FirstSubtype' => _$FirstSubtypeFromJson(json),
156149 /// 'SecondSubtype' => _$SecondSubtypeFromJson(json),
157150 /// _ => throw Exception('Unknown type: ${json['type']}'),
158151 /// };
159- /// '''
160152 /// ```
161153 String _createSealedFunctionExpressionBody () {
162154 assert (element.isSealed);
@@ -195,7 +187,6 @@ _ => throw UnrecognizedUnionTypeException(
195187 ///
196188 /// For example:
197189 /// ```dart
198- /// '''
199190 /// $checkedCreate(
200191 /// 'FirstSubtype',
201192 /// json,
@@ -211,7 +202,6 @@ _ => throw UnrecognizedUnionTypeException(
211202 /// return val;
212203 /// },
213204 /// );
214- /// '''
215205 /// ```
216206 String _createCheckedFunctionExpressionBody (
217207 _ConstructorData data,
@@ -278,39 +268,31 @@ _ => throw UnrecognizedUnionTypeException(
278268 ///
279269 /// ```dart
280270 /// [
281- /// '''
282271 /// ExampleClass(
283272 /// json['exampleField'] as String,
284273 /// )
285- /// '''
286274 /// ]
287275 /// /* OR with fields to set */
288276 /// [
289- /// '''
290277 /// ExampleClass(
291278 /// json['exampleField'] as String,
292279 /// )
293280 /// ..field1 = json['field1'] as String
294- /// ..field2 = json['field2'] as String;
295- /// '''
281+ /// ..field2 = json['field2'] as String
296282 /// ]
297283 /// ```
298284 ///
299285 /// If there are checks, will return the checks followed by the
300286 /// constructor invocation.
301287 /// ```dart
302288 /// [
303- /// '''
304289 /// $checkKeys(
305290 /// json,
306291 /// allowedKeys: const ['exampleField', 'field1', 'field2'],
307- /// )
308- /// ''',
309- /// '''
292+ /// ),
310293 /// ExampleClass(
311294 /// json['exampleField'] as String,
312295 /// )
313- /// '''
314296 /// ]
315297 /// ```
316298 ///
0 commit comments