division icon indicating copy to clipboard operation
division copied to clipboard

After flutter upgrade, I've got this error

Open abdullojony opened this issue 2 years ago • 2 comments

/C:/Users/user/AppData/Local/Pub/Cache/hosted/pub.dev/division-0.9.0/lib/src/build.dart:100:48: Error: The argument type 'BorderRadius?' can't be assigned to the parameter type 'BorderRadiusGeometry' because 'BorderRadius?' is nullable and 'BorderRadiusGeometry' isn't.

  • 'BorderRadius' is from 'package:flutter/src/painting/border_radius.dart' ('/D:/src/flutter/packages/flutter/lib/src/painting/border_radius.dart'). border_radius.dart:1

  • 'BorderRadiusGeometry' is from 'package:flutter/src/painting/border_radius.dart' ('/D:/src/flutter/packages/flutter/lib/src/painting/border_radius.dart'). border_radius.dart:1 borderRadius: decoration?.borderRadius as BorderRadius?, ^

Target kernel_snapshot failed: Exception

abdullojony avatar Sep 18 '23 02:09 abdullojony

After upgrading Flutter to 3.13.6 from 3.7.1, I get the same error

justoke avatar Oct 10 '23 07:10 justoke

@just-abdul1ah I got around this by just modifying the build.dart file from the flutter cache, allowing me to build it. I'd suggest this as a workaround. I'll submit a pull request when I can get round to it.

Basically, you need to add a default wherever BorderRadius? is used: youruserfolder\AppData\Local\Pub\Cache\hosted\pub.dev\division-0.9.0\lib\src\build.dart

Replace all instances of BorderRadius?, with BorderRadius? ?? BorderRadius.circular(0.0), image

I have no idea if the constant I used is suitable for all scenarios, but alternatively you could use: BorderRadius ?? BorderRadius.zero,

justoke avatar Oct 10 '23 09:10 justoke