小编TSR*_*TSR的帖子

如何通过堆栈跟踪调试 flutter web?

当我从 Flutter 移动设备转移到 Web 设备时,我注意到控制台上打印的日志没有帮助,因为它们不针对我的 IDE (Android Studio) 中的代码 在移动设备上:

======= Exception caught by widgets library =======================================================
The following message was thrown building PhoneSignUpPage(state: _PhoneSignUpPageState#b52e9):
some error

The relevant error-causing widget was: 
  PhoneSignUpPage file:///Users/me/AndroidStudioProjects/myproject/lib/services/routing_service.dart:30:14
When the exception was thrown, this was the stack: 
#0      PhonePageViewState.initState (package:my_app/common/phone/phone_page_view.dart:63:5) // this was clickable
#1      StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4711:57)
#2      ComponentElement.mount (package:flutter/src/widgets/framework.dart:4548:5)
#3      Element.inflateWidget (package:flutter/src/widgets/framework.dart:3611:14)
#4      Element.updateChild (package:flutter/src/widgets/framework.dart:3360:20)
...
Run Code Online (Sandbox Code Playgroud)

在网络上:

======== Exception caught by widgets library =======================================================
The following message was thrown building PhoneSignUpPage(state: _PhoneSignUpPageState#fb057):
some …
Run Code Online (Sandbox Code Playgroud)

dart android-studio flutter flutter-web

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

颤振图标 3 点

Flutter的材质库有没有3点图标

Icon(Icons.three_dots_overflow),
Run Code Online (Sandbox Code Playgroud)

呃

material-design flutter

25
推荐指数
3
解决办法
2万
查看次数

如果不存在,FireStore会创建一个文档

我想更新这样的文档:

db.collection('users').doc(user_id).update({foo:'bar'})
Run Code Online (Sandbox Code Playgroud)

但是,如果doc user_id不存在,则上面的代码将引发错误.因此,如果不存在,如何告诉Firestore创建学生,换句话说,行为如下:

db.collection('users').doc(user_id).set({foo:'bar'})
Run Code Online (Sandbox Code Playgroud)

node.js firebase google-cloud-firestore

16
推荐指数
2
解决办法
6014
查看次数

Angular Firebase 应用程序在 20 小时后崩溃,内存分配为 +1 GB

我发现使用AngularFireAuthModulefrom '@angular/fire/auth';会导致内存泄漏,导致 20 小时后浏览器崩溃。

版本:

我使用今天更新的最新版本,对所有软件包使用 ncu -u。

角火: "@angular/fire": "^5.2.3",

Firebase 版本: "firebase": "^7.5.0",

如何重现:

我在StackBliztz 编辑器上做了一个最小的可重现代码

这里是直接测试bug的链接StackBlizt test

症状:

您可以自己检查代码是否没有任何作用。它只是打印 hello world。但是,Angular App 使用的 JavaScript 内存增加了11 kb/s(Chrome 任务管理器 CRTL+ESC)。打开浏览器 10 小时后,使用的内存达到约800 mb(内存占用量约为1.6 Gb 的两倍!)

结果,浏览器内存不足,chrome 选项卡崩溃。

在性能选项卡下使用chrome的内存分析进一步调查后,我清楚地注意到侦听器的数量每秒增加2个,因此JS堆相应增加。

在此处输入图片说明

导致内存泄漏的代码:

我发现使用该AngularFireAuthModule 模块会导致内存泄漏,无论是在component构造函数中还是在service.

import { Component } from '@angular/core';
import {AngularFireAuth} from '@angular/fire/auth';
import {AngularFirestore} from '@angular/fire/firestore';

@Component({
  selector: 'app-root',
  templateUrl: …
Run Code Online (Sandbox Code Playgroud)

firebase angularfire angular

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

迟到相当于什么?懒惰| TypeScript 中的 Lateinit ?

Dart、Kotlin 和 Swift 有一个延迟初始化关键字,主要出于可维护性的原因,可以让您避免使用可选类型。

// Using null safety:
class Coffee {
  late String _temperature;

  void heat() { _temperature = 'hot'; }
  void chill() { _temperature = 'iced'; }

  String serve() => _temperature + ' coffee';
}
Run Code Online (Sandbox Code Playgroud)

TypeScript 有什么等价物?

null initialization lazy-initialization typescript option-type

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

如何在Dart中传播列表

在Javascript中,我将使用传播运算符:

在此处输入图片说明

现在我对Flutter遇到了同样的问题:

 Widget build(BuildContext context) {
    return Column(
      children: <Widget>[
        MyHeader(),
        _buildListOfWidgetForBody(), // <- how to spread this <Widget>[] ????
        MyCustomFooter(),
      ],
    );
  }
Run Code Online (Sandbox Code Playgroud)

dart flutter

14
推荐指数
3
解决办法
4619
查看次数

为什么在Python 3.7中int(x-1)== x True,某些值为x?

在Python 3.7 int(x-1) == xTrue 对于x = 5e+17 为什么会这样?我如何防止这种错误?

要进行复制,请将其粘贴到您的Python控制台中:

int(5e+17-1) == 5e+17
>True
Run Code Online (Sandbox Code Playgroud)

(我正在使用,int因为x是除法的结果,我需要将其解析为int。)

python

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

如何在 IntelliJ 控制台中过滤 Flutter 应用程序的日志记录?

在开发 Flutter 应用程序时 - 我最感兴趣的是我创建的日志消息print()- 在本例中调用记录器I/flutter(图中的第 4 行)。
但我收到了许多其他记录器的垃圾邮件,如下所示。

除了关闭和打开之外,是否有一种简单的方法可以打开所有其他记录器I/flutter

在此输入图像描述

intellij-idea dart flutter

13
推荐指数
2
解决办法
5496
查看次数

错误:ExpressionChangedAfterItHasBeenCheckedError:以前的值:'ng-untouched:true'。当前值:'ng-untouched:false'

我用最少的代码在StackBlitz上重现了这个问题。

第一步:点击文字

第 2 步:专注于文本字段

第 3 步:输入 Enter 并检查控制台是否有此错误

错误:ExpressionChangedAfterItHasBeenCheckedError:检查后表达式已更改。以前的值:'ng-untouched: true'。当前值:'ng-untouched:false'。

angular

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

如何在不更改缓存键的情况下删除 Azure Pipeline 缓存

我有一个创建缓存的任务

- task: Cache@2
  inputs:
    key: 'sonarCache'
    path: $(SONAR_CACHE)
    cacheHitVar: CACHE_RESTORED
  displayName: Cache Sonar packages
Run Code Online (Sandbox Code Playgroud)

但是,缓存已损坏。那么我如何运行这个管道,同时告诉它忽略任何现有的缓存?

由于某种原因,我无法更改缓存键sonarCache

pipeline azure azure-devops azure-pipelines azure-pipelines-yaml

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