问题

组件不修改

  • 组件外包裹 StatefulBuilder
  • builder参数的值修改为 (context, setState) => Text()
  • 在需要修改的地方调用 setState((){})

傻逼udp组件官网

官网的示例是错的,收信息这样收

1
2
3
4
5
6
7
8
9
10
11
12
static void receive() {
RawDatagramSocket.bind(InternetAddress.anyIPv4, receiverPort)
.then((RawDatagramSocket udpSocket) {
udpSocket.broadcastEnabled = true;
udpSocket.listen((e) {
Datagram? dg = udpSocket.receive();
if (dg != null) {
Log.info("received ${String.fromCharCodes(dg.data)}");
}
});
});
}

go_router传参

其他和vue-router一样,还有个extra

1679231892356

声明函数

1
final void Function(String msg) confirm;

组件布局问题

listview中的gridview

1
2
3
4
5
6
7
8
9
return GridView(
// 禁止滚动
physics: const NeverScrollableScrollPhysics(),
// 自适应
shrinkWrap: true,
gridDelegate: const SliverGridDelegateWithMaxCrossAxisExtent(
maxCrossAxisExtent: 100),
children: children,
);