小编Aki*_*kif的帖子

如何通过smtp发送邮件gmail?

我在尝试执行此邮件发送方法时收到异常。

{"语法错误,命令无法识别。服务器响应为:"}

我的代码:

public async static Task SendExceptionMail(Exception e)
    {
        try
        {
            //TODO: fill..

            var message = new MailMessage();
            message.To.Add("other_email_than_my_email@gmail.com");
            message.From = new MailAddress("my_email_in_gmail@gmail.com");

            message.Subject = "Server Exception Occured";

            StringBuilder sb = new StringBuilder();
            sb.AppendLine("Exception occured. Stack trace:");
            sb.AppendLine(e.StackTrace);
            sb.AppendLine("");
            sb.AppendLine("Time: " + DateTime.UtcNow);

            message.Body = sb.ToString();
            message.IsBodyHtml = false;
            message.BodyEncoding = UTF8Encoding.UTF8;

            using (var smtpClient = new SmtpClient())
            {
                smtpClient.Credentials = new System.Net.NetworkCredential("my_email_in_gmail@gmail.com", "very_very_complicated_password_with_numbers_and_signs");
                smtpClient.Host = "smtp.gmail.com";
                smtpClient.Port = 465;
                smtpClient.EnableSsl = true;
                smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
                //smtpClient.UseDefaultCredentials = false; …
Run Code Online (Sandbox Code Playgroud)

c# smtp

1
推荐指数
1
解决办法
6385
查看次数

如何解决颤振医生错误说已连接设备(医生检查崩溃)?

当我尝试运行 flutter doctor 时,它向我表明

   "Connected  devices (the doctor check crashed)
    Due to an error, the doctor Check did not complete."
Run Code Online (Sandbox Code Playgroud)

我该如何解决这个问题?

android flutter

1
推荐指数
1
解决办法
1万
查看次数

如何从颤振中的坐标获取城市?

我正在使用Flutter 上的GeoLocator依赖项,并且能够获取位置的实时坐标。

但我只想导出城市的广义坐标,我该怎么做。

下面的代码在使用上述依赖项时提供准确的实时位置,但我不需要。

我想要基于地理位置的城市名称。

请指导我应该如何实现它?

 await Geolocator.getCurrentPosition().then((value) => {
                        _positionItems.add(_PositionItem(
                            _PositionItemType.position, value.toString()))
                      });
Run Code Online (Sandbox Code Playgroud)

maps geolocation dart flutter

1
推荐指数
1
解决办法
1万
查看次数

Flutter - 异常:类型“int”不是类型“double”的子类型

我在后台解析 JSON 时遇到了困难。我正在使用FoodData API

以下是对一道菜的响应示例:

{
"fdcId": 167782,
"description": "Abiyuch, raw",
"dataType": "SR Legacy",
"publicationDate": "2019-04-01",
"ndbNumber": "9427",
"foodNutrients": [
{
"number": "318",
"name": "Vitamin A, IU",
"amount": 100,
"unitName": "IU",
"derivationCode": "A",
"derivationDescription": "Analytical"
},
{
"number": "268",
"name": "Energy",
"amount": 290,
"unitName": "kJ",
"derivationCode": "NC",
"derivationDescription": "Calculated"
},
]
Run Code Online (Sandbox Code Playgroud)

我使用 JSON 到 DART 转换器并得到了这个输出 -

class FoodGen {
  int fdcId;
  String description;
  String dataType;
  String publicationDate;
  String ndbNumber;
  List<FoodNutrients> foodNutrients;

  FoodGen(
      {this.fdcId,
      this.description,
      this.dataType,
      this.publicationDate,
      this.ndbNumber, …
Run Code Online (Sandbox Code Playgroud)

string double json integer flutter

1
推荐指数
1
解决办法
3863
查看次数

如何在 Flutter 中将文本放在 textbutton.icon 的图标下?

我是编码新手,不确定如何将文本放入实际图标下的 TextButton.icon 中。请问你能帮忙吗?这是代码:

        TextButton.icon(
          onPressed: () => {},
          icon: Icon(
            Icons.add,
            color: Colors.white,
            size: 50,
          ),
          label: Text(
              'Label',
              style: TextStyle(
                color: Colors.white,
              ),
          )),
Run Code Online (Sandbox Code Playgroud)

dart flutter flutter-layout

1
推荐指数
1
解决办法
2104
查看次数

Flutter项目规模确实非常庞大。如何减少呢?

我刚刚制作了一个Hello World应用程序,但是文件大小非常。有没有办法减少项目文件的大小?

project filesize dart flutter

0
推荐指数
1
解决办法
9175
查看次数

如何将 RevenueCat 集成到我的 flutter 示例应用程序中?

我正在尝试探索应用内购买应用程序的 RevenueCat。我想构建一个示例应用程序,其中显示一些具有购买和订阅的产品。我可以将 RevenueCat 集成到我的 flutter 示例应用程序中,还是需要一个真实的应用程序来检查该流程。

flutter revenuecat

0
推荐指数
1
解决办法
965
查看次数

类没有实例 getter 'length'

我正在尝试在屏幕上创建一个包含从远程服务器加载的项目的列表。

\n
 Container(\n              child: FutureBuilder(\n                future: fetchClinicas(),\n                builder: (context, snapshot) {\n                  if (snapshot.hasData) {\n                    return ListView.builder(\n                      itemCount: snapshot.data.length,\n                      shrinkWrap: true,\n                      itemBuilder: (BuildContext contex, index) {\n                        Clinica clinica = snapshot.data[index];\n                        return Text(\n                          '${clinica.nombreClinica}',\n                          style: TextStyle(fontSize: 20),\n                        );\n                      },\n                    );\n                  }\n                  return CircularProgressIndicator();\n                },\n              ),\n            ),\n
Run Code Online (Sandbox Code Playgroud)\n

这里有两个文件:

\n

临床API.dart

\n
Future<List<Clinica>> fetchClinicas() async {\n  String url ="https://.../get_clinicas.php";\n  final response = await http.get(url);\n  return clinicaFromJson(response.body);\n\n}\n
Run Code Online (Sandbox Code Playgroud)\n

和模型类Clinica.dart

\n
import 'dart:convert';\n\nList<Clinica> clinicaFromJson(String str) => List<Clinica>.from(json.decode(str).map((x) => Clinica.fromJson(x)));\n\nString clinicaToJson(List<Clinica> data) => json.encode(List<dynamic>.from(data.map((x) => …
Run Code Online (Sandbox Code Playgroud)

dart flutter

0
推荐指数
1
解决办法
4523
查看次数

反应模块解析失败:意外令牌 (1:48)

有人能帮我吗?我只是创建反应应用程序然后我立即启动它。然后我得到了这样的错误。我对 webpack 了解不多。

CMD

./src/index.js 1:48
Module parse failed: Unexpected token (1:48)
File was processed with these loaders:
 * ./node_modules/@pmmmwh/react-refresh-webpack-plugin/loader/index.js
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
> $RefreshRuntime$ = require('C:/Users/LENOVO/Mine/project-new/node_modules/react-refresh/runtime.js');
| $RefreshSetup$(module.id);
|
Run Code Online (Sandbox Code Playgroud)

我只是输入npx create-react-app ./目录npm start 然后这个错误发生了。我曾尝试制作 3 个 react 应用程序,但发生了同样的事情,而且我以前从未接触过 webpack。

应用程序.js

import logo from './logo.svg';
import './App.css';

function App() {
  return (
    <div className="App">
      <header className="App-header">
        <img src={logo} className="App-logo" alt="logo" />
        <p>
          Edit <code>src/App.js</code> and …
Run Code Online (Sandbox Code Playgroud)

javascript reactjs webpack

0
推荐指数
1
解决办法
3611
查看次数