after installing flutter_html: ^2.2.1 project does not start

60 views Asked by At

I have created a a flutter project and installed those packages

environment:
  sdk: ">=3.0.5 <4.0.0"

dependencies:
  flutter:
    sdk: flutter

  cupertino_icons: ^1.0.2
  google_fonts: ^5.1.0
  get: ^4.6.5
  phlox_animations: ^2.1.1
  shared_preferences: ^2.1.2
  http: ^1.1.0
  google_nav_bar: ^5.0.6
  carousel_slider: ^4.2.1
  intl:
  syncfusion_flutter_datepicker: ^23.1.38
  syncfusion_flutter_calendar: ^23.1.42
  flutter_slidable: ^3.0.0
  image_picker: ^1.0.4
  flutter_html: ^2.2.1

dev_dependencies:
  flutter_test:
    sdk: flutter

  flutter_lints: ^2.0.0
  device_preview: ^1.1.0

after installing

flutter_html: ^2.2.1

project doeas not start

So after do some research I found that happens because I have to update minimum sdk version to 21

so I have updated app level build grade file like this

defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "XXXXXXX"
        // You can update the following values to match your application needs.
        // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
        minSdkVersion 21
        targetSdkVersion flutter.targetSdkVersion
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

after did this change project run succesfully.

BUT

when I try to use flutter_html package to view html string in my flutter app this gives me error. this happens even I import the package.

import statement I used

import 'package:flutter_html/flutter_html.dart';

ERROR message in console

Launching lib\main.dart on sdk gphone x86 in debug mode...
../../../../AppData/Local/Pub/Cache/hosted/pub.dev/flutter_math_fork-0.5.0/lib/src/widgets/selection/gesture_detector_builder.dart:186:20: Error: The argument type 'void Function(TapDownDetails)' can't be assigned to the parameter type 'void Function(TapDragDownDetails)?'.
 - 'TapDownDetails' is from 'package:flutter/src/gestures/tap.dart' ('/C:/FlutterDev/flutter/packages/flutter/lib/src/gestures/tap.dart').
 - 'TapDragDownDetails' is from 'package:flutter/src/widgets/tap_and_drag_gestures.dart' ('/C:/FlutterDev/flutter/packages/flutter/lib/src/widgets/tap_and_drag_gestures.dart').
        onTapDown: onTapDown,
                   ^
../../../../AppData/Local/Pub/Cache/hosted/pub.dev/flutter_math_fork-0.5.0/lib/src/widgets/selection/gesture_detector_builder.dart:190:24: Error: The argument type 'void Function(TapUpDetails)' can't be assigned to the parameter type 'void Function(TapDragUpDetails)?'.
 - 'TapUpDetails' is from 'package:flutter/src/gestures/tap.dart' ('/C:/FlutterDev/flutter/packages/flutter/lib/src/gestures/tap.dart').
 - 'TapDragUpDetails' is from 'package:flutter/src/widgets/tap_and_drag_gestures.dart' ('/C:/FlutterDev/flutter/packages/flutter/lib/src/widgets/tap_and_drag_gestures.dart').
        onSingleTapUp: onSingleTapUp,
                       ^
../../../../AppData/Local/Pub/Cache/hosted/pub.dev/flutter_math_fork-0.5.0/lib/src/widgets/selection/gesture_detector_builder.dart:195:26: Error: The argument type 'void Function(TapDownDetails)' can't be assigned to the parameter type 'void Function(TapDragDownDetails)?'.
 - 'TapDownDetails' is from 'package:flutter/src/gestures/tap.dart' ('/C:/FlutterDev/flutter/packages/flutter/lib/src/gestures/tap.dart').
 - 'TapDragDownDetails' is from 'package:flutter/src/widgets/tap_and_drag_gestures.dart' ('/C:/FlutterDev/flutter/packages/flutter/lib/src/widgets/tap_and_drag_gestures.dart').
        onDoubleTapDown: onDoubleTapDown,
                         ^
../../../../AppData/Local/Pub/Cache/hosted/pub.dev/flutter_math_fork-0.5.0/lib/src/widgets/selection/gesture_detector_builder.dart:196:31: Error: The argument type 'void Function(DragStartDetails)' can't be assigned to the parameter type 'void Function(TapDragStartDetails)?'.
 - 'DragStartDetails' is from 'package:flutter/src/gestures/drag_details.dart' ('/C:/FlutterDev/flutter/packages/flutter/lib/src/gestures/drag_details.dart').
 - 'TapDragStartDetails' is from 'package:flutter/src/widgets/tap_and_drag_gestures.dart' ('/C:/FlutterDev/flutter/packages/flutter/lib/src/widgets/tap_and_drag_gestures.dart').
        onDragSelectionStart: onDragSelectionStart,
                              ^
../../../../AppData/Local/Pub/Cache/hosted/pub.dev/flutter_math_fork-0.5.0/lib/src/widgets/selection/gesture_detector_builder.dart:197:32: Error: The argument type 'void Function(DragStartDetails, DragUpdateDetails)' can't be assigned to the parameter type 'void Function(TapDragUpdateDetails)?'.
 - 'DragStartDetails' is from 'package:flutter/src/gestures/drag_details.dart' ('/C:/FlutterDev/flutter/packages/flutter/lib/src/gestures/drag_details.dart').
 - 'DragUpdateDetails' is from 'package:flutter/src/gestures/drag_details.dart' ('/C:/FlutterDev/flutter/packages/flutter/lib/src/gestures/drag_details.dart').
 - 'TapDragUpdateDetails' is from 'package:flutter/src/widgets/tap_and_drag_gestures.dart' ('/C:/FlutterDev/flutter/packages/flutter/lib/src/widgets/tap_and_drag_gestures.dart').
        onDragSelectionUpdate: onDragSelectionUpdate,
                               ^
../../../../AppData/Local/Pub/Cache/hosted/pub.dev/flutter_math_fork-0.5.0/lib/src/widgets/selection/gesture_detector_builder.dart:198:29: Error: The argument type 'void Function(DragEndDetails)' can't be assigned to the parameter type 'void Function(TapDragEndDetails)?'.
 - 'DragEndDetails' is from 'package:flutter/src/gestures/drag_details.dart' ('/C:/FlutterDev/flutter/packages/flutter/lib/src/gestures/drag_details.dart').
 - 'TapDragEndDetails' is from 'package:flutter/src/widgets/tap_and_drag_gestures.dart' ('/C:/FlutterDev/flutter/packages/flutter/lib/src/widgets/tap_and_drag_gestures.dart').
        onDragSelectionEnd: onDragSelectionEnd,
                            ^
../../../../AppData/Local/Pub/Cache/hosted/pub.dev/flutter_layout_grid-1.0.6/lib/src/widgets/placement.dart:82:55: Error: A value of type 'RenderObject?' can't be assigned to a variable of type 'AbstractNode?'.
 - 'RenderObject' is from 'package:flutter/src/rendering/object.dart' ('/C:/FlutterDev/flutter/packages/flutter/lib/src/rendering/object.dart').
 - 'AbstractNode' is from 'package:flutter/src/foundation/node.dart' ('/C:/FlutterDev/flutter/packages/flutter/lib/src/foundation/node.dart').
      final AbstractNode? targetParent = renderObject.parent;
                                                      ^
../../../../AppData/Local/Pub/Cache/hosted/pub.dev/flutter_layout_grid-1.0.6/lib/src/widgets/placement.dart:83:58: Error: The method 'markNeedsPlacement' isn't defined for the class 'AbstractNode?'.
 - 'AbstractNode' is from 'package:flutter/src/foundation/node.dart' ('/C:/FlutterDev/flutter/packages/flutter/lib/src/foundation/node.dart').
Try correcting the name to the name of an existing method, or defining a method named 'markNeedsPlacement'.
      if (targetParent is RenderLayoutGrid) targetParent.markNeedsPlacement();
                                                         ^^^^^^^^^^^^^^^^^^
../../../../AppData/Local/Pub/Cache/hosted/pub.dev/flutter_layout_grid-1.0.6/lib/src/widgets/placement.dart:84:54: Error: The method 'markNeedsLayout' isn't defined for the class 'AbstractNode?'.
 - 'AbstractNode' is from 'package:flutter/src/foundation/node.dart' ('/C:/FlutterDev/flutter/packages/flutter/lib/src/foundation/node.dart').
Try correcting the name to the name of an existing method, or defining a method named 'markNeedsLayout'.
      if (targetParent is RenderObject) targetParent.markNeedsLayout();
                                                     ^^^^^^^^^^^^^^^
../../../../AppData/Local/Pub/Cache/hosted/pub.dev/flutter_layout_grid-1.0.6/lib/src/widgets/placement.dart:132:55: Error: A value of type 'RenderObject?' can't be assigned to a variable of type 'AbstractNode?'.
 - 'RenderObject' is from 'package:flutter/src/rendering/object.dart' ('/C:/FlutterDev/flutter/packages/flutter/lib/src/rendering/object.dart').
 - 'AbstractNode' is from 'package:flutter/src/foundation/node.dart' ('/C:/FlutterDev/flutter/packages/flutter/lib/src/foundation/node.dart').
      final AbstractNode? targetParent = renderObject.parent;
                                                      ^
../../../../AppData/Local/Pub/Cache/hosted/pub.dev/flutter_layout_grid-1.0.6/lib/src/widgets/placement.dart:133:58: Error: The method 'markNeedsPlacement' isn't defined for the class 'AbstractNode?'.
 - 'AbstractNode' is from 'package:flutter/src/foundation/node.dart' ('/C:/FlutterDev/flutter/packages/flutter/lib/src/foundation/node.dart').
Try correcting the name to the name of an existing method, or defining a method named 'markNeedsPlacement'.
      if (targetParent is RenderLayoutGrid) targetParent.markNeedsPlacement();
                                                         ^^^^^^^^^^^^^^^^^^
../../../../AppData/Local/Pub/Cache/hosted/pub.dev/flutter_layout_grid-1.0.6/lib/src/widgets/placement.dart:134:54: Error: The method 'markNeedsLayout' isn't defined for the class 'AbstractNode?'.
 - 'AbstractNode' is from 'package:flutter/src/foundation/node.dart' ('/C:/FlutterDev/flutter/packages/flutter/lib/src/foundation/node.dart').
Try correcting the name to the name of an existing method, or defining a method named 'markNeedsLayout'.
      if (targetParent is RenderObject) targetParent.markNeedsLayout();
                                                     ^^^^^^^^^^^^^^^
Target kernel_snapshot failed: Exception


FAILURE: Build failed with an exception.

* Where:
Script 'C:\FlutterDev\flutter\packages\flutter_tools\gradle\src\main\groovy\flutter.groovy' line: 1297

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\FlutterDev\flutter\bin\flutter.bat'' finished with non-zero exit value 1
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 11s
Exception: Gradle task assembleDebug failed with exit code 1


Exited (1).

0

There are 0 answers