[flutter_markdown] Remove TaskListSyntax and rely on markdown native checkbox support - Fixes https://github.com/flutter/flutter/issues/107871 (#2338)

diff --git a/packages/flutter_markdown/CHANGELOG.md b/packages/flutter_markdown/CHANGELOG.md
index a31a13c..ebb7b04 100644
--- a/packages/flutter_markdown/CHANGELOG.md
+++ b/packages/flutter_markdown/CHANGELOG.md
@@ -1,3 +1,9 @@
+## 0.6.11
+
+* Deprecates and removes use of `TaskListSyntax` as new markdown package supports checkboxes natively.
+  Consider using `OrderedListWithCheckBoxSyntax` or `UnorderedListWithCheckBoxSyntax` as a replacement.
+* Changes `_buildCheckbox()` to inspect state of checkbox input element by existence of `'checked'` attribute.
+
 ## 0.6.10+6
 
 * Removes print logged when not handling hr for alignment.
diff --git a/packages/flutter_markdown/example/pubspec.yaml b/packages/flutter_markdown/example/pubspec.yaml
index a335dba..8e21f40 100644
--- a/packages/flutter_markdown/example/pubspec.yaml
+++ b/packages/flutter_markdown/example/pubspec.yaml
@@ -11,7 +11,7 @@
     sdk: flutter
   flutter_markdown:
     path: ../
-  markdown: 5.0.0
+  markdown: ^6.0.0
 
 dev_dependencies:
   flutter_test:
diff --git a/packages/flutter_markdown/lib/src/builder.dart b/packages/flutter_markdown/lib/src/builder.dart
index 115f289..20809eb 100644
--- a/packages/flutter_markdown/lib/src/builder.dart
+++ b/packages/flutter_markdown/lib/src/builder.dart
@@ -386,7 +386,7 @@
           Widget bullet;
           final dynamic el = element.children![0];
           if (el is md.Element && el.attributes['type'] == 'checkbox') {
-            final bool val = el.attributes['checked'] != 'false';
+            final bool val = el.attributes.containsKey('checked');
             bullet = _buildCheckbox(val);
           } else {
             bullet = _buildBullet(_listIndents.last);
diff --git a/packages/flutter_markdown/lib/src/widget.dart b/packages/flutter_markdown/lib/src/widget.dart
index 17f7406..bfdce31 100644
--- a/packages/flutter_markdown/lib/src/widget.dart
+++ b/packages/flutter_markdown/lib/src/widget.dart
@@ -310,8 +310,7 @@
 
     final md.Document document = md.Document(
       blockSyntaxes: widget.blockSyntaxes,
-      inlineSyntaxes: (widget.inlineSyntaxes ?? <md.InlineSyntax>[])
-        ..add(TaskListSyntax()),
+      inlineSyntaxes: widget.inlineSyntaxes,
       extensionSet: widget.extensionSet ?? md.ExtensionSet.gitHubFlavored,
       encodeHtml: false,
     );
@@ -548,11 +547,16 @@
 }
 
 /// Parse [task list items](https://github.github.com/gfm/#task-list-items-extension-).
+///
+/// This class is no longer used as Markdown now supports checkbox syntax natively.
+@Deprecated(
+    'Use [OrderedListWithCheckBoxSyntax] or [UnorderedListWithCheckBoxSyntax]')
 class TaskListSyntax extends md.InlineSyntax {
-  /// Cretaes a new instance.
+  /// Creates a new instance.
+  @Deprecated(
+      'Use [OrderedListWithCheckBoxSyntax] or [UnorderedListWithCheckBoxSyntax]')
   TaskListSyntax() : super(_pattern);
 
-  // FIXME: Waiting for dart-lang/markdown#269 to land
   static const String _pattern = r'^ *\[([ xX])\] +';
 
   @override
diff --git a/packages/flutter_markdown/pubspec.yaml b/packages/flutter_markdown/pubspec.yaml
index 59f33ba..19a678f 100644
--- a/packages/flutter_markdown/pubspec.yaml
+++ b/packages/flutter_markdown/pubspec.yaml
@@ -4,7 +4,7 @@
   formatted with simple Markdown tags.
 repository: https://github.com/flutter/packages/tree/main/packages/flutter_markdown
 issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+flutter_markdown%22
-version: 0.6.10+6
+version: 0.6.11
 
 environment:
   sdk: ">=2.12.0 <3.0.0"
@@ -13,7 +13,7 @@
 dependencies:
   flutter:
     sdk: flutter
-  markdown: ^5.0.0
+  markdown: ^6.0.0
   meta: ^1.3.0
   path: ^1.8.0
 
diff --git a/packages/flutter_markdown/test/list_test.dart b/packages/flutter_markdown/test/list_test.dart
index 4aca6f4..f3f8aa7 100644
--- a/packages/flutter_markdown/test/list_test.dart
+++ b/packages/flutter_markdown/test/list_test.dart
@@ -5,6 +5,8 @@
 import 'package:flutter/material.dart';
 import 'package:flutter_markdown/flutter_markdown.dart';
 import 'package:flutter_test/flutter_test.dart';
+import 'package:markdown/markdown.dart'
+    show indicatorForCheckedCheckBox, indicatorForUncheckedCheckBox;
 import 'utils.dart';
 
 void main() => defineTests();
@@ -129,9 +131,9 @@
 
         expectTextStrings(widgets, <String>[
           String.fromCharCode(Icons.check_box.codePoint),
-          'Item 1',
+          '${indicatorForCheckedCheckBox}Item 1',
           String.fromCharCode(Icons.check_box_outline_blank.codePoint),
-          'Item 2',
+          '${indicatorForUncheckedCheckBox}Item 2',
         ]);
       },
     );
@@ -177,9 +179,9 @@
 
         expectTextStrings(widgets, <String>[
           'true',
-          'Item 1',
+          '${indicatorForCheckedCheckBox}Item 1',
           'false',
-          'Item 2',
+          '${indicatorForUncheckedCheckBox}Item 2',
         ]);
       },
     );