相关疑难解决方法(0)

92
推荐指数
10
解决办法
2万
查看次数

The element type 'int' can't be assigned to the map value type 'FieldValue' when trying to assign a new value

I have initial data which works fine.

var data = {field1: FieldValue.increment(1)};
Run Code Online (Sandbox Code Playgroud)

And it is also fine when I add another field to the data.

data.addAll({field2: FieldValue.increment(1)});
Run Code Online (Sandbox Code Playgroud)

But if I set the value to 0, it won't allow me to.

data.addAll({field3: 0});
Run Code Online (Sandbox Code Playgroud)

It will give an error of: The element type 'int' can't be assigned to the map value type 'FieldValue'.

I tried doing this but still, have the same issue.

data[field3] = 0;
Run Code Online (Sandbox Code Playgroud)

How will I set the field3 …

dart firebase flutter

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

Dart 中 Object、Dynamic 和 Var 的区别?

在空安全之前有一个关于空安全的讨论。那么他们每个人之间又有什么关系呢?dynamicvarObject?

  1. Object? == dynamic
  2. var?和怎么样dynamic?
  3. dynamic?和之间有什么区别吗dynamic

我看到了官方文档null-safety,但找不到相关主题。

dart dart-null-safety

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

标签 统计

dart ×3

const ×1

dart-null-safety ×1

final ×1

firebase ×1

flutter ×1

keyword ×1