gpt4 book ai didi

flutter - 错误 : You should set `SILENT_OBSERVATORY` to true when debugging the VM

转载 作者:行者123 更新时间:2023-12-02 11:17:53 27 4
gpt4 key购买 nike

我正在创建聊天,这是我收到的错误:
警告:您应该设置 SILENT_OBSERVATORY调试 VM 时设置为 true,因为默认情况下它将输出天文台 URL。
这打破了各种记者契约(Contract)。
要设置值定义 DART_VM_OPTIONS=-DSILENT_OBSERVATORY=true .
我没有更改 widget_test.dart 中的任何内容,但这是我启动应用程序时的样子:
enter image description here
完整代码在这里:

void main() async {

final client = Client(
'b67pax5b2wdq',
logLevel: Level.INFO,
);

await client.setUser(
User(id: 'falling-mountain-7'),
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiZmFsbGluZy1tb3VudGFpbi03In0.AKgRXHMQQMz6vJAKszXdY8zMFfsAgkoUeZHlI-Szz9E',

);

runApp(MaterialApp(home: Chat(client)));


class Chat extends StatelessWidget {
final Client client;

Chat(this.client);

@override
Widget build(BuildContext context) {
return MaterialApp(
home: Container(
child: StreamChat(
client: client,
child: ChannelListPage(),
),
),
);
}
}

class ChannelListPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: ChannelListView(
filter: {
'members': {
'\$in': [StreamChat.of(context).user.id],
}
},
sort: [SortOption('last_message_at')],
pagination: PaginationParams(
limit: 20,
),
channelWidget: ChannelPage(),
),
);
}
}

class ChannelPage extends StatelessWidget {
const ChannelPage({
Key key,
}) : super(key: key);

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: ChannelHeader(),
body: Column(
children: <Widget>[
Expanded(
child: MessageListView(
messageBuilder: _messageBuilder,
),
),
MessageInput(),
],
),
);
}

Widget _messageBuilder(context, message, index) {
final isCurrentUser = StreamChat.of(context).user.id == message.user.id;
final textAlign = isCurrentUser ? TextAlign.right : TextAlign.left;
final color = isCurrentUser ? Colors.blueGrey : Colors.blue;

return Padding(
padding: EdgeInsets.all(20.0),
child: Container(
decoration: BoxDecoration(
color: Colors.blue,
//border: Border.all(color: color, width: 1),
borderRadius: BorderRadius.all(
Radius.circular(45.0),
),
),
child: ListTile(
title: Text(
message.text,
textAlign: textAlign,
),
subtitle: Text(
message.user.extraData['name'],
textAlign: textAlign,
),
),
),
);
}
}

最佳答案

随着 M47.1 的发布,此问题已得到修复(标记代码已恢复)。下载它,你应该很高兴去。
变更日志 here

关于flutter - 错误 : You should set `SILENT_OBSERVATORY` to true when debugging the VM,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62589342/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com