Home > OS >  i downloaded a flutter project from a friend and i got this error
i downloaded a flutter project from a friend and i got this error

Time:06-03

strong text

Error: Cannot run with sound null safety, because the following dependencies don't support null safety:

  • package:google_fonts
  • package:http
  • package:http_parser

For solutions, see https://dart.dev/go/unsound-null-safety /C:/src/flutter/packages/flutter/lib/src/material/circle_avatar.dart:108:9: Error: Type 'ImageProvider' not found. final ImageProvider? backgroundImage; ^^^^^^^^^^^^^ /C:/src/flutter/packages/flutter/lib/src/material/circle_avatar.dart:113:9: Error: Type 'ImageProvider' not found. final ImageProvider? foregroundImage; ^^^^^^^^^^^^^ /C:/src/flutter/packages/flutter/lib/src/material/ink_decoration.dart:185:14: Error: Type 'ImageProvider' not found. required ImageProvider image, ^^^^^^^^^^^^^ /C:/src/flutter/packages/flutter/lib/src/material/ink_decoration.dart:336:14: Error: Type 'ImageConfiguration' not found. required ImageConfiguration configuration, ^^^^^^^^^^^^^^^^^^ /C:/src/flutter/packages/flutter/lib/src/material/ink_decoration.dart:369:3: Error: Type 'ImageConfiguration' not found. ImageConfiguration get configuration => _configuration; ^^^^^^^^^^^^^^^^^^ /C:/src/flutter/packages/flutter/lib/src/material/ink_decoration.dart:370:3: Error: Type 'ImageConfiguration' not found. ImageConfiguration _configuration; ^^^^^^^^^^^^^^^^^^ /C:/src/flutter/packages/flutter/lib/src/material/ink_decoration.dart:371:21: Error: Type 'ImageConfiguration' not found. set configuration(ImageConfiguration value) { ^^^^^^^^^^^^^^^^^^ /C:/src/flutter/packages/flutter/lib/src/material/switch.dart:210:9: Error: Type 'ImageProvider' not found. final ImageProvider? activeThumbImage; ^^^^^^^^^^^^^ /C:/src/flutter/packages/flutter/lib/src/material/switch.dart:219:9: Error: Type 'ImageProvider' not found. final ImageProvider? inactiveThumbImage; ^^^^^^^^^^^^^ /C:/src/flutter/packages/flutter/lib/src/material/switch.dart:530:9: Error: Type 'ImageProvider' not found. final ImageProvider? activeThumbImage; ^^^^^^^^^^^^^ /C:/src/flutter/packages/flutter/lib/src/material/switch.dart:532:9: Error: Type 'ImageProvider' not found. final ImageProvider? inactiveThumbImage; ^^^^^^^^^^^^^ /C:/src/flutter/packages/flutter/lib/src/material/switch.dart:795:3: Error: Type 'ImageProvider' not found. ImageProvider? get activeThumbImage => _activeThumbImage; ^^^^^^^^^^^^^ /C:/src/flutter/packages/flutter/lib/src/material/switch.dart:796:3: Error: Type 'ImageProvider' not found. ImageProvider? _activeThumbImage; ^^^^^^^^^^^^^ /C:/src/flutter/packages/flutter/lib/src/material/switch.dart:797:24: Error: Type 'ImageProvider' not found. set activeThumbImage(ImageProvider? value) { ^^^^^^^^^^^^^ /C:/src/flutter/packages/flutter/lib/src/material/switch.dart:814:3: Error: Type 'ImageProvider' not found. ImageProvider? get inactiveThumbImage => _inactiveThumbImage;

^^^^^^^^^^^^^^^^^^

/C:/src/flutter/packages/flutter/lib/src/widgets/scroll_aware_image_provider.dart:110:36: Error: Type 'DecoderCallback' not found. ImageStreamCompleter load(T key, DecoderCallback decode) => imageProvider.load(key, decode); ^^^^^^^^^^^^^^^ /C:/src/flutter/packages/flutter/lib/src/widgets/scroll_aware_image_provider.dart:113:23: Error: Type 'ImageConfiguration' not found. Future obtainKey(ImageConfiguration configuration) => imageProvider.obtainKey(configuration); ^^^^^^^^^^^^^^^^^^ /C:/src/flutter/packages/flutter/lib/src/cupertino/route.dart:915:44: Error: Type 'ImageConfiguration' not found. void paint(Canvas canvas, Offset offset, ImageConfiguration configuration) { ^^^^^^^^^^^^^^^^^^ /C:/src/flutter/packages/flutter/lib/src/rendering/proxy_box.dart:2088:5: Error: Type 'ImageConfiguration' not found. ImageConfiguration configuration = ImageConfiguration.empty, ^^^^^^^^^^^^^^^^^^ /C:/src/flutter/packages/flutter/lib/src/rendering/proxy_box.dart:2132:3: Error: Type 'ImageConfiguration' not found. ImageConfiguration get configuration => _configuration; ^^^^^^^^^^^^^^^^^^ /C:/src/flutter/packages/flutter/lib/src/rendering/proxy_box.dart:2133:3: Error: Type 'ImageConfiguration' not found. ImageConfiguration _configuration; ^^^^^^^^^^^^^^^^^^ /C:/src/flutter/packages/flutter/lib/src/rendering/proxy_box.dart:2134:21: Error: Type 'ImageConfiguration' not found. set configuration(ImageConfiguration value) { ^^^^^^^^^^^^^^^^^^ /C:/src/flutter/packages/flutter/lib/src/rendering/table.dart:376:5: Error: Type 'ImageConfiguration' not found. ImageConfiguration configuration = ImageConfiguration.empty, ^^^^^^^^^^^^^^^^^^ /C:/src/flutter/packages/flutter/lib/src/rendering/table.dart:552:3: Error: Type 'ImageConfiguration' not found. ImageConfiguration get configuration => _configuration;

    ^^^^^^^^^^^^^

/C:/src/flutter/packages/flutter/lib/src/material/circle_avatar.dart:113:9: Error: 'ImageProvider' isn't a type. final ImageProvider? foregroundImage; ^^^^^^^^^^^^^ /C:/src/flutter/packages/flutter/lib/src/material/dropdown.dart:81:42: Error: The method 'ImageConfiguration' isn't defined for the class '_DropdownMenuPainter'.

  • '_DropdownMenuPainter' is from 'package:flutter/src/material/dropdown.dart' ('/C:/src/flutter/packages/flutter/lib/src/material/dropdown.dart'). Try correcting the name to the name of an existing method, or defining a method named 'ImageConfiguration'. _painter.paint(canvas, rect.topLeft, ImageConfiguration(size: rect.size)); ^^^^^^^^^^^^^^^^^^ /C:/src/flutter/packages/flutter/lib/src/material/ink_decoration.dart:185:14: Error: 'ImageProvider' isn't a type. required ImageProvider image, ^^^^^^^^^^^^^ /C:/src/flutter/packages/flutter/lib/src/material/ink_decoration.dart:336:14: Error: 'ImageConfiguration' isn't a type. required ImageConfiguration configuration, ^^^^^^^^^^^^^^^^^^ /C:/src/flutter/packages/flutter/lib/src/material/ink_decoration.dart:370:3: Error: 'ImageConfiguration' isn't a type. ImageConfiguration _configuration; ^^^^^^^^^^^^^^^^^^ /C:/src/flutter/packages/flutter/lib/src/material/ink_decoration.dart:371:21: Error: 'ImageConfiguration' isn't a type. set configuration(ImageConfiguration value) { ^^^^^^^^^^^^^^^^^^ /C:/src/flutter/packages/flutter/lib/src/material/ink_decoration.dart:394:11: Error: 'ImageConfiguration' isn't a type. final ImageConfiguration sizedConfiguration = configuration.copyWith( ^^^^^^^^^^^^^^^^^^ /C:/src/flutter/packages/flutter/lib/src/material/switch.dart:210:9: Error: 'ImageProvider' isn't a type. final ImageProvider? activeThumbImage; ^^^^^^^^^^^^^ /C:/src/flutter/packages/flutter/lib/src/material/switch.dart:219:9: Error: 'ImageProvider' isn't a type. final ImageProvider? inactiveThumbImage; ^^^^^^^^^^^^^ /C:/src/flutter/packages/flutter/lib/src/material/switch.dart:530:9: Error: 'ImageProvider' isn't a type. final ImageProvider? activeThumbImage; ^^^^^^^^^^^^^ /C:/src/flutter/packages/flutter/lib/src/material/switch.dart:532:9: Error: 'ImageProvider' isn't a type. final ImageProvider? inactiveThumbImage; ^^^^^^^^^^^^^ /C:/src/flutter/packages/flutter/lib/src/material/switch.dart:796:3: Error: 'ImageProvider' isn't a type. ImageProvider? _activeThumbImage; ^^^^^^^^^^^^^ /C:/src/flutter/packages/flutter/lib/src/material/switch.dart:797:24: Error: 'ImageProvider' isn't a type. set activeThumbImage(ImageProvider? value) { ^^^^^^^^^^^^^ /C:/src/flutter/packages/flutter/lib/src/material/switch.dart:815:3: Error: 'ImageProvider' isn't a type. ImageProvider? _inactiveThumbImage; ^^^^^^^^^^^^^ /C:/src/flutter/packages/flutter/lib/src/material/switch.dart:816:26: Error: 'ImageProvider' isn't a type. set inactiveThumbImage(ImageProvider? value) { ^^^^^^^^^^^^^ /C:/src/flutter/packages/flutter/lib/src/material/switch.dart:854:3: Error: 'ImageConfiguration' isn't a type. ImageConfiguration? _configuration; ^^^^^^^^^^^^^^^^^^ /C:/src/flutter/packages/flutter/lib/src/material/switch.dart:855:21: Error: 'ImageConfiguration' isn't a type. set configuration(ImageConfiguration value) { ^^^^^^^^^^^^^^^^^^ /C:/src/flutter/packages/flutter/lib/src/material/switch.dart:904:3: Error: 'ImageProvider' isn't a type. ImageProvider? _cachedThumbImage; ^^^^^^^^^^^^^ /C:/src/flutter/packages/flutter/lib/src/material/switch.dart:908:60: Error: 'ImageProvider' isn't a type. BoxDecoration _createDefaultThumbDecoration(Color color, ImageProvider? image, ImageErrorListener? errorListener) { ^^^^^^^^^^^^^ /C:/src/flutter/packages/flutter/lib/src/material/switch.dart:950:11: Error: 'ImageProvider' isn't a type. final ImageProvider? thumbImage = isEnabled ^^^^^^^^^^^^^ /C:/src/flutter/packages/flutter/lib/src/material/switch.dart:1018:5: Error: 'ImageProvider' isn't a type. ImageProvider? thumbImage, ^^^^^^^^^^^^^ /C:/src/flutter/packages/flutter/lib/src/material/switch_list_tile.dart:265:9: Error: 'ImageProvider' isn't a type. final ImageProvider? activeThumbImage; ^^^^^^^^^^^^^ /C:/src/flutter/packages/flutter/lib/src/material/switch_list_tile.dart:270:9: Error: 'ImageProvider' isn't a type. final ImageProvider? inactiveThumbImage;

/C:/src/flutter/packages/flutt strong texter/lib/src/painting/image_resolution.dart:283:41: Error: 'ImageConfiguration' isn't a type. Future obtainKey(ImageConfiguration configuration) { ^^^^^^^^^^^^^^^^^^ /C:/src/flutter/packages/flutter/lib/src/painting/image_resolution.dart:291:15: Error: 'AssetBundleImageKey' isn't a type. Completer? completer; ^^^^^^^^^^^^^^^^^^^ /C:/src/flutter/packages/flutter/lib/src/painting/image_resolution.dart:292:12: Error: 'AssetBundleImageKey' isn't a type. Future? result; ^^^^^^^^^^^^^^^^^^^ /C:/src/flutter/packages/flutter/lib/src/painting/image_resolution.dart:302:15: Error: 'AssetBundleImageKey' isn't a type. final AssetBundleImageKey key = AssetBundleImageKey( ^^^^^^^^^^^^^^^^^^^ /C:/src/flutter/packages/flutter/lib/src/painting/image_resolution.dart:317:38: Error: 'AssetBundleImageKey' isn't a type. result = SynchronousFuture(key); ^^^^^^^^^^^^^^^^^^^ /C:/src/flutter/packages/flutter/lib/src/painting/image_resolution.dart:334:27: Error: 'AssetBundleImageKey' isn't a type. completer = Completer(); ^^^^^^^^^^^^^^^^^^^ /C:/src/flutter/packages/flutter/lib/src/painting/image_resolution.dart:302:41: Error: The method 'AssetBundleImageKey' isn't defined for the class 'AssetImage'.

  • 'AssetImage' is from 'package:flutter/src/painting/image_resolution.dart' ('/C:/src/flutter/packages/flutter/lib/src/painting/image_resolution.dart'). Try correcting the name to the name of an existing method, or defining a method named 'AssetBundleImageKey'. final AssetBundleImageKey key = AssetBundleImageKey( ^^^^^^^^^^^^^^^^^^^ /C:/src/flutter/packages/flutter/lib/src/painting/image_resolution.dart:351:39: Error: 'ImageConfiguration' isn't a type. String? _chooseVariant(String main, ImageConfiguration config, List? candidates) { ^^^^^^^^^^^^^^^^^^ /C:/src/flutter/packages/flutter/lib/src/painting/shape_decoration.dart:365:35: Error: 'ImageConfiguration' isn't a type. void _paintImage(Canvas canvas, ImageConfiguration configuration) { ^^^^^^^^^^^^^^^^^^ /C:/src/flutter/packages/flutter/lib/src/painting/shape_decoration.dart:379:44: Error: 'ImageConfiguration' isn't a type. void paint(Canvas canvas, Offset offset, ImageConfiguration configuration) { ^^^^^^^^^^^^^^^^^^

FAILURE: Build failed with an exception.

  • Where: Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1156

  • What went wrong: Execution failed for task ':app:compileFlutterBuildDebug'.

Process 'command 'C:\src\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 19s Exception: Gradle task assembleDebug failed with exit code 1

CodePudding user response:

You should install the same flutter version your friend use. I think yours version is greater. Ask your friend to send you flutter doctor output and make your flutter version the same.

FVM might be a suitable tool for this (install a needed version without deleting your own): https://fvm.app/docs/getting_started/installation

Then simply run:

fvm install [version of your friend]
fvm use [version]
  • Related