'How i can fix this issue?? i can't compile my flutter web

How i can fix this ??

flutter build web

Building with sound null safety

Target dart2js failed: Exception: Warning: The 'dart2js' entrypoint script is deprecated, please use 'dart compile js' instead. /C:/Users/DELL/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/flutter_screenutil-5.3.1/lib/screenutil_init.dart:23:54: Warning: Operand of null-aware operation '!' has type 'WidgetsBinding' which excludes null.

  • 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('/C:/flutter/packages/flutter/lib/src/widgets/binding.dart'). data: MediaQueryData.fromWindow(WidgetsBinding.instance!.window), ^ /C:/Users/DELL/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/flutter_riverpod-1.0.3/lib/src/framework.dart:275:26: Warning: Operand of null-aware operation '!' has type 'SchedulerBinding' which excludes null.
  • 'SchedulerBinding' is from 'package:flutter/src/scheduler/binding.dart' ('/C:/flutter/packages/flutter/lib/src/scheduler/binding.dart'). if (SchedulerBinding.instance!.schedulerPhase == ^ /C:/flutter/packages/flutter/lib/src/widgets/binding.dart:419:19: Error: The argument type 'Future<Map<String, dynamic>> Function()' can't be assigned to the parameter type 'Future<Map<String, dynamic>> Function(Map<String, String>)'.
  • 'Future' is from 'dart:async'.
  • 'Map' is from 'dart:core'. callback: () async { ^ /C:/flutter/packages/flutter/lib/src/widgets/binding.dart:433:19: Error: The argument type 'Future<Map<String, dynamic>> Function()' can't be assigned to the parameter type 'Future<Map<String, dynamic>> Function(Map<String, String>)'.
  • 'Future' is from 'dart:async'.
  • 'Map' is from 'dart:core'. callback: () async { ^ /C:/Users/DELL/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/get-4.6.1/lib/get_navigation/src/extension_navigation.dart:357:24: Warning: Operand of null-aware operation '!' has type 'SchedulerBinding' which excludes null.
  • 'SchedulerBinding' is from 'package:flutter/src/scheduler/binding.dart' ('/C:/flutter/packages/flutter/lib/src/scheduler/binding.dart'). SchedulerBinding.instance!.addPostFrameCallback((_) { ^ /C:/Users/DELL/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/get-4.6.1/lib/get_navigation/src/extension_navigation.dart:468:24: Warning: Operand of null-aware operation '!' has type 'SchedulerBinding' which excludes null.
  • 'SchedulerBinding' is from 'package:flutter/src/scheduler/binding.dart' ('/C:/flutter/packages/flutter/lib/src/scheduler/binding.dart'). SchedulerBinding.instance!.addPostFrameCallback((_) { ^ /C:/Users/DELL/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/get-4.6.1/lib/get_navigation/src/snackbar/snackbar.dart:452:22: Warning: Operand of null-aware operation '!' has type 'SchedulerBinding' which excludes null.
  • 'SchedulerBinding' is from 'package:flutter/src/scheduler/binding.dart' ('/C:/flutter/packages/flutter/lib/src/scheduler/binding.dart'). SchedulerBinding.instance!.addPostFrameCallback( ^ /C:/Users/DELL/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/get-4.6.1/lib/get_state_manager/src/rx_flutter/rx_disposable.dart:20:22: Warning: Operand of null-aware operation '?.' has type 'SchedulerBinding' which excludes null.
  • 'SchedulerBinding' is from 'package:flutter/src/scheduler/binding.dart' ('/C:/flutter/packages/flutter/lib/src/scheduler/binding.dart'). SchedulerBinding.instance?.addPostFrameCallback((_) => onReady()); ^ /C:/Users/DELL/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/get-4.6.1/lib/get_state_manager/src/rx_flutter/rx_notifier.dart:130:22: Warning: Operand of null-aware operation '?.' has type 'SchedulerBinding' which excludes null.
  • 'SchedulerBinding' is from 'package:flutter/src/scheduler/binding.dart' ('/C:/flutter/packages/flutter/lib/src/scheduler/binding.dart'). SchedulerBinding.instance?.addPostFrameCallback((_) => onReady()); ^ /C:/Users/DELL/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/get-4.6.1/lib/get_state_manager/src/simple/get_controllers.dart:90:20: Warning: Operand of null-aware operation '!' has type 'WidgetsBinding' which excludes null.
  • 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('/C:/flutter/packages/flutter/lib/src/widgets/binding.dart'). WidgetsBinding.instance!.addObserver(this); ^ /C:/Users/DELL/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/get-4.6.1/lib/get_state_manager/src/simple/get_controllers.dart:96:20: Warning: Operand of null-aware operation '!' has type 'WidgetsBinding' which excludes null.
  • 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('/C:/flutter/packages/flutter/lib/src/widgets/binding.dart'). WidgetsBinding.instance!.removeObserver(this); ^ /C:/Users/DELL/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/get-4.6.1/lib/get_navigation/src/router_report.dart:53:22: Warning: Operand of null-aware operation '!' has type 'WidgetsBinding' which excludes null.
  • 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('/C:/flutter/packages/flutter/lib/src/widgets/binding.dart'). WidgetsBinding.instance!.addPostFrameCallback((_) { ^ /C:/Users/DELL/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/cached_network_image-3.2.0/lib/src/image_provider/cached_network_image_provider.dart:109:29: Warning: Operand of null-aware operation '?.' has type 'PaintingBinding' which excludes null.
  • 'PaintingBinding' is from 'package:flutter/src/painting/binding.dart' ('/C:/flutter/packages/flutter/lib/src/painting/binding.dart'). () => PaintingBinding.instance?.imageCache?.evict(key), ^ /C:/Users/DELL/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/cached_network_image-3.2.0/lib/src/image_provider/multi_image_stream_completer.dart:152:22: Warning: Operand of null-aware operation '?.' has type 'SchedulerBinding' which excludes null.
  • 'SchedulerBinding' is from 'package:flutter/src/scheduler/binding.dart' ('/C:/flutter/packages/flutter/lib/src/scheduler/binding.dart'). SchedulerBinding.instance?.scheduleFrameCallback(_handleAppFrame); ^ /C:/Users/DELL/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/material_floating_search_bar-0.3.6/lib/src/util/util.dart:18:18: Warning: Operand of null-aware operation '?.' has type 'WidgetsBinding' which excludes null.
  • 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('/C:/flutter/packages/flutter/lib/src/widgets/binding.dart'). WidgetsBinding.instance?.addPostFrameCallback((_) => callback()); ^ Error: Compilation failed.

Compiling lib\main.dart for the Web... 24.2s Exception: Failed to compile application for the Web.



Solution 1:[1]

I got this type of issue but it solved for me with

flutter run -d chrome --web-hostname localhost --web-port 5000 Try running this command.

Solution 2:[2]

Try this command:

flutter build web --no-sound-null-safety

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sabirklm
Solution 2 M Karimi