Error: The argument type 'BorderRadius?' can't be assigned to the parameter type 'BorderRadiusGeometry'
chrisokwakol opened this issue · comments
Trying to run my app with 'flutter run' produces this error:
`../../../../.pub-cache/hosted/pub.dev/flash-2.0.5+1/lib/flash.dart:534:30: 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' ('../../../../../Chris/Desktop/flutter/flutter/packages/flutter/lib/src/painting/border_radius.dart').
- 'BorderRadiusGeometry' is from 'package:flutter/src/painting/border_radius.dart' ('../../../../../Chris/Desktop/flutter/flutter/packages/flutter/lib/src/painting/border_radius.dart').
borderRadius: widget.borderRadius,
^
Target kernel_snapshot failed: Exception
FAILURE: Build failed with an exception.
-
Where:
Script '/Users/Chris/Desktop/flutter/flutter/packages/flutter_tools/gradle/src/main/groovy/flutter.groovy' line: 1350 -
What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
Process 'command '/Users/Chris/Desktop/flutter/flutter/bin/flutter'' 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 13s
Running Gradle task 'assembleDebug'... 14.3s
Exception: Gradle task assembleDebug failed with exit code 1
`
I don't think this is a issue with flash
.
I'm new to flutter but based on what I've been reading and this error path '../../../../.pub-cache/hosted/pub.dev/flash-2.0.5+1/lib/flash.dart:534:30:' it looks kind of similar to this issue ReinBentdal/division#75
Adding this line fixed the issue :
` @OverRide
Widget build(BuildContext context) {
Widget child = widget.child;
if (widget.borderRadius != null) {
child = ClipRRect(
// borderRadius: widget.borderRadius,
borderRadius: widget.borderRadius ?? BorderRadius.zero, // add a default wherever BorderRadius? is used
child: child,
);
}`
I don't think this is a issue with
flash
.
@sososdk
yes it is coming out from this plugin.
@chrisokwakol can you please guide on the workaround for this issue. where to add the override build function,
thanks in advance.