I am using flutter 3.19.6 to compile a program which
import ‘_network_image_io.dart’
if (dart.library.js_util) ‘_network_image_web.dart’ as network_image;
but the the following messages appeared. Is there anybody has encounter this problem? And how to fix it?
Launching libmain.dart on Chrome in debug mode…
/C:/dev/flutter/packages/flutter/lib/src/painting/image_provider.dart:1406:89: Error: The constructor function type ‘NetworkImage/1/ Function(String, {Map<String, String>? headers, double scale})’ isn’t a subtype of ‘NetworkImage/2/ Function(String?, {Map<String, String>? headers, double scale})’.
- ‘NetworkImage/1/’ is from ‘package:flutter/src/painting/_network_image_web.dart’ (‘/C:/dev/flutter/packages/flutter/lib/src/painting/_network_image_web.dart’).
- ‘Map’ is from ‘dart:core’.
- ‘NetworkImage/2/’ is from ‘package:flutter/src/painting/image_provider.dart’ (‘/C:/dev/flutter/packages/flutter/lib/src/painting/image_provider.dart’).
const factory NetworkImage(String? url, { double scale, Map<String, String>? headers })=network_image.NetworkImage;
^
Failed to compile application.
Exited (1).
I have tried the ‘flutter doctor’ to fix this problem, but still not work.
Does anyone know how to fix it?
David Fan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.