我创建了一个使用 mysql 来验证用户登录的 ac# 程序。我在谷歌上搜索了连接字符串的安全性,每件事都是关于 web.config 文件的。是否有必要在纯 C# 程序中隐藏连接字符串?如果是,请给我参考这样做。
我加密了我的代码,这足以保护我程序中的连接字符串吗?
private static MySqlConnection myConnection = new MySqlConnection("sample connection string");
Run Code Online (Sandbox Code Playgroud)
解决问题后的微小编辑:我找到了App.config为连接字符串设计的加密文章和项目,您可以在此处查看
想要使用流从服务器的实时数据创建列表视图,因此创建假数据流,然后将其快照保存在列表中以测试结果,当在 ListTile 中使用该列表并运行应用程序时,会出现以下错误:
构建 ListTile(dirty) 时抛出以下断言:找不到材质小部件。
ListTile 小部件需要一个 Material 小部件祖先。
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: SafeArea(
child: Center(
child: StreamBuilderPage(),
),
),
);
}
}
class StreamBuilderPage extends StatefulWidget {
@override
_StreamBuilderPageState createState() => _StreamBuilderPageState();
}
class _StreamBuilderPageState extends State<StreamBuilderPage> {
List<int> items = [];
@override
Widget build(BuildContext context) {
return StreamBuilder(
//Error number 2
stream: NumberCreator().stream,
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return …Run Code Online (Sandbox Code Playgroud)