Flutter null safety issues, unable to compile

4,762

easy_web_view: ^1.4.0-nullsafety uses the package html2md in version 0.5.1, that does not fully support null safety.

html2md is available in version 1.0.0 that does support null safety, but there was no update to easy_web_view that uses this new version.

You will have to wait for the maintainer of easy_web_view to create an updated version or you can help and branch it and do it yourself.

Share:
4,762
Damandroid
Author by

Damandroid

Updated on December 19, 2022

Comments

  • Damandroid
    Damandroid over 1 year

    I am having the following errors when building my FLUTTER WEB application:

    Error: Cannot run with sound null safety, because the following dependencies don't support null safety:
    
     - package:html2md
     - package:html
     - package:csslib
    
    For solutions, see https://dart.dev/go/unsound-null-safety ../../../flutter/.pub-cache/hosted/pub.dartlang.org/easy_web_view-1.4.0-nullsafety/lib/src/web.dart:61:5: Warning: Operand of null-aware operation '?.' has type 'EasyWebView' which excludes null.
     - 'EasyWebView' is from 'package:easy_web_view/src/web.dart' ('../../../flutter/.pub-cache/hosted/pub.dartlang.org/easy_web_view-1.4.0-nullsafety/lib/src/web.dart').
        widget?.onLoaded();
        ^ ../../../flutter/.pub-cache/hosted/pub.dartlang.org/easy_web_view-1.4.0-nullsafety/lib/src/web.dart:66:15: Warning: Operand of null-aware operation '?.' has type 'EasyWebView' which excludes null.
     - 'EasyWebView' is from 'package:easy_web_view/src/web.dart' ('../../../flutter/.pub-cache/hosted/pub.dartlang.org/easy_web_view-1.4.0-nullsafety/lib/src/web.dart').
              if (widget?.onLoaded != null) {
                  ^ ../../../flutter/.pub-cache/hosted/pub.dartlang.org/easy_web_view-1.4.0-nullsafety/lib/src/web.dart:95:14: Warning: Operand of null-aware operation '?.' has type 'EasyWebView' which excludes null.
     - 'EasyWebView' is from 'package:easy_web_view/src/web.dart' ('../../../flutter/.pub-cache/hosted/pub.dartlang.org/easy_web_view-1.4.0-nullsafety/lib/src/web.dart').
          width: widget?.width,
                 ^ ../../../flutter/.pub-cache/hosted/pub.dartlang.org/easy_web_view-1.4.0-nullsafety/lib/src/web.dart:96:15: Warning: Operand of null-aware operation '?.' has type 'EasyWebView' which excludes null.
     - 'EasyWebView' is from 'package:easy_web_view/src/web.dart' ('../../../flutter/.pub-cache/hosted/pub.dartlang.org/easy_web_view-1.4.0-nullsafety/lib/src/web.dart').
          height: widget?.height,
                  ^ ../../../flutter/.pub-cache/hosted/pub.dartlang.org/easy_web_view-1.4.0-nullsafety/lib/src/web.dart:124:20: Warning: Operand of null-aware operation '?.' has type 'EasyWebView' which excludes null.
     - 'EasyWebView' is from 'package:easy_web_view/src/web.dart' ('../../../flutter/.pub-cache/hosted/pub.dartlang.org/easy_web_view-1.4.0-nullsafety/lib/src/web.dart').
                  key: widget?.key,
                       ^ Unhandled exception: Bad state: Unsupported Null Safety mode NonNullableByDefaultCompiledMode.Invalid, in null.
    #0      ProgramCompiler.emitModule (package:dev_compiler/src/kernel/compiler.dart:435:9)
    #1      JavaScriptBundler.compile (package:frontend_server/src/javascript_bundle.dart:144:33)
    #2      FrontendCompiler.writeJavascriptBundle (package:frontend_server/frontend_server.dart:632:20) <asynchronous suspension>
    #3      FrontendCompiler.compile (package:frontend_server/frontend_server.dart:545:9) <asynchronous suspension>
    #4      listenAndCompile.<anonymous closure> (package:frontend_server/frontend_server.dart:1105:11) <asynchronous suspension> Finished with error: the Dart compiler exited unexpectedly. Failed to compile application.
    

    The following are my dependencies:

      cupertino_icons: ^1.0.2
      http: ^0.13.1
      json_annotation: ^4.0.1
      provider: ^5.0.0
      google_fonts: ^2.0.0
      vibration: ^1.7.4-nullsafety.0 #^1.7.4
      firebase_core: ^1.0.2
      cloud_firestore: ^1.0.2
      easy_web_view: ^1.4.0-nullsafety #easy_web_view: ^1.3.0
      intl: ^0.17.0
      uuid: ^3.0.2
      url_launcher: ^6.0.2
      shared_preferences: ^2.0.5
    
  • m123
    m123 about 3 years
    @Damandroid probably create a issue in github.com/rodydavis/easy_web_view about it
  • Rody Davis
    Rody Davis over 2 years
    I will update it soon! Please submit a PR