-
Hi, thanks first, component looks neat indeed! I'm still very confused how to find out which Currently I'm stuck around the exact same issue described in #264. I've looked quickly throughout the example, read through the wiki, noticed some similar questions (#218, maybe others) and I'm still not really clear on how to pipe, e.g. some identifier with my data. My guess, among other attempts, was that What did I miss here ?
I'm going to add a bit code, so it's more contextual. $ flutter --version
Flutter 3.0.5 • channel stable • https://github.com/flutter/flutter.git
Framework • revision f1875d570e (7 weeks ago) • 2022-07-13 11:24:16 -0700
Engine • revision e85ea0e79c
Tools • Dart 2.17.6 • DevTools 2.12.2 click to expand code excerpt.class ListWaybillsWidgetState extends ConsumerState<ListWaybillsWidget> {
// ...
@override
Widget build(BuildContext context) {
return Column(
children: [
ListView.builder(
// ...
itemBuilder: (context, index) {
final String uuid = widget.waybills[index].uuid;
return slidable(context, uuid);
},
)
],
);
}
static Widget slidable(BuildContext context, String uuid) => Slidable(
key: ValueKey(uuid),
endActionPane: const ActionPane(
motion: ScrollMotion(),
children: [
SlidableAction(
key: ValueKey('delete'),
onPressed: (BuildContext context) => onWaybillDelete(context, uuid), <--- here compiler error
// ...
),
],
),
child: ListTile(
title: Text(uuid),
));
}
void onWaybillDelete(BuildContext context, String uuid) {
// here e.g. call to db to delete record
} click to expand compiler error message.Type: void Function(BuildContext, String) package:flutter_rust_bridge_template/widgets/waybill.dart
The values in a const list literal must be constants.
Try removing the keyword 'const' from the list literal.dart[non_constant_list_element](https://dart.dev/diagnostics/non_constant_list_element)
Invalid constant value.dart(invalid_constant) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Ok I actually missed a simple |
Beta Was this translation helpful? Give feedback.
Ok I actually missed a simple
const
on myActionPane
😅 No it actually works just as expected, no need forstatic
or method chaining or anything, sorry !