createState Mathod在StatefulWidget中不起作用....它显示以下错误

时间:2020-09-12 04:30:14

标签: flutter flutter-test flutter-method-channel

createState方法无法正常工作。

using MongoDB.Entities;
using System.Threading.Tasks;

namespace TestApp
{
    public class ApiUsers : Entity
    {
        public string UserEMail { get; set; }
    }

    internal static class Program
    {
        private static async Task Main()
        {
            await DB.InitAsync("test", "localhost");

            await new[] {
                new ApiUsers { UserEMail = "test@test.com"},
                new ApiUsers { UserEMail = "test@test.com"},
                new ApiUsers { UserEMail = "test@test.com"},
                new ApiUsers { UserEMail = "teX@teX.com"},
            }.SaveAsync();

            var idToKeep = (await DB.Find<ApiUsers, string>()
                                    .Match(u => u.UserEMail == "test@test.com")
                                    .Project(u => u.ID)
                                    .Limit(1)
                                    .ExecuteAsync())[0];

            await DB.DeleteAsync<ApiUsers>(
                u => u.UserEMail == "test@test.com" &&
                     u.ID != idToKeep);
        }
    }
}

显示此错误 [1]:https://i.stack.imgur.com/An0iV.png

0 个答案:

没有答案