I just updated to Dart2 and Flutter sdk: '>=2.12.0 <3.0.0' and now this if statement breaks:
decoration: new BoxDecoration(
shape: BoxShape.circle,
color: Colors.blueAccent,
border: Border.all(
color: Colors.blueAccent,
width: 20.0,
style: BorderStyle.solid),
image: new DecorationImage(
fit: BoxFit.cover,
image: myMarkerThumb != 'noImage'
? NetworkImage(myMarkerThumb)
: AssetImage('assets/images/noImageAvailable.png'),
),
),
The argument type 'Object' can't be assigned to the parameter type 'ImageProvider'. ),
I'm just starting with flutter and have no idea where to look else.
The argument type 'Object' can't be assigned to the parameter type 'ImageProvider'. ), I'm just starting with flutter and have no idea where to look else. Show activity on this post. Hey this is currently an issue I opened in the flutter repo with dart 2.12.
The argument type 'JsObject' can't be assigned to the parameter type 'BuildContext'. · Issue #66800 · flutter/flutter · GitHub Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
This meant it was valid to assign, for example, a function with a parameter of type String to a place that expected a function type with a parameter of dynamic. However, in Dart 2 using a parameter type other than dynamic (or another top type, such as Object?) results in a compile-time error.
Hey this is currently an issue I opened in the flutter repo with dart 2.12.
A simple workaround you could make in the meantime is just to cast the object.
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.blueAccent,
border: Border.all(
color: Colors.blueAccent,
width: 20.0,
style: BorderStyle.solid),
image: DecorationImage(
fit: BoxFit.cover,
image: myMarkerThumb != 'noImage'
? NetworkImage(myMarkerThumb)
: AssetImage('assets/images/noImageAvailable.png') as ImageProvider,
),
),
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With