improve dartfix fix descriptions and add examples

Change-Id: I19c74bd9c55da29460ebe6f41b79e327429d6b22
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105323
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
diff --git a/pkg/analysis_server/lib/src/edit/fix/dartfix_info.dart b/pkg/analysis_server/lib/src/edit/fix/dartfix_info.dart
index c6a3ef7..421b8cc 100644
--- a/pkg/analysis_server/lib/src/edit/fix/dartfix_info.dart
+++ b/pkg/analysis_server/lib/src/edit/fix/dartfix_info.dart
@@ -16,44 +16,94 @@
 
 const allFixes = <DartFixInfo>[
   //
-  // Required fixes
+  // Fixes enabled by default
   //
   const DartFixInfo(
     'fix-named-constructor-type-arguments',
-    'Move named constructor type arguments from the name to the type.',
+    '''
+Move named constructor type arguments from the name to the type.
+
+For example, this
+  new List.filled<String>(20, 'value');
+
+will be converted to
+  new List<String>.filled(20, 'value');''',
     FixErrorTask.fixNamedConstructorTypeArgs,
     isRequired: true,
   ),
   const DartFixInfo(
     'use-mixin',
-    'Convert classes used as a mixin to the new mixin syntax.',
+    '''
+Convert classes used as a mixin to the new mixin syntax.
+
+For example, this
+  class C with M { }
+  class M { }
+
+will be converted to
+  class C with M { }
+  mixin M { }
+
+There are several situations where a class cannot be automatically converted
+to a mixin such as when the class contains a constructor. In that situation
+a message is displayed and the class is not converted to a mixin.''',
     PreferMixinFix.task,
     isRequired: true,
   ),
   //
-  // Suggested fixes
+  // Fixes that may be explicitly enabled
   //
   const DartFixInfo(
     'double-to-int',
-    'Find double literals ending in .0 and remove the .0 '
-    'wherever double context can be inferred.',
+    '''
+Find double literals ending in .0 and remove the .0
+wherever double context can be inferred.
+
+For example, this
+  const double myDouble = 8.0;
+
+will be converted to
+  const double myDouble = 8;''',
     PreferIntLiteralsFix.task,
   ),
   const DartFixInfo(
     'use-spread-collections',
-    'Convert to using collection spread operators.',
+    '''
+Convert to using collection spread operators.
+
+For example, this
+  var l1 = ['b'];
+  var l2 = ['a']..addAll(l1);
+
+will be converted to
+  var l1 = ['b'];
+  var l2 = ['a', ...l1];''',
     PreferSpreadCollectionsFix.task,
     isDefault: false,
   ),
   const DartFixInfo(
     'collection-if-elements',
-    'Convert to using if elements when building collections.',
+    '''
+Convert to using if elements when building collections.
+
+For example, this
+  f(bool b) => ['a', b ? 'c' : 'd', 'e'];
+
+will be converted to
+  f(bool b) => ['a', if (b) 'c' else 'd', 'e'];''',
     PreferIfElementsToConditionalExpressionsFix.task,
     isDefault: false,
   ),
   const DartFixInfo(
     'map-for-elements',
-    'Convert to for elements when building maps from iterables.',
+    '''
+Convert to for elements when building maps from iterables.
+
+For example, this
+  Map<int, int>.fromIterable([1, 2, 3], key: (i) => i, value: (i) => i * 2)
+
+will be converted to
+  <int, int>{ for(int i in [1, 2, 3]) i : i * 2, }''',
     PreferForElementsToMapFromIterableFix.task,
     isDefault: false,
   ),
@@ -64,8 +114,10 @@
     'non-nullable',
     // TODO(danrubel) update description and make default/required
     // when NNBD fix is ready
-    'Experimental: Update sources to be non-nullable by default.\n'
-    'This requires the experimental non-nullable flag to be enabled.',
+    '''
+EXPERIMENTAL: Update sources to be non-nullable by default.
+This requires the experimental non-nullable flag to be enabled
+when running the updated application.''',
     NonNullableFix.task,
     isDefault: false,
   ),