颤振混合模式"未定义吸气剂"


background: ShaderMask(
shaderCallback: (rect) {
return LinearGradient(
begin: Alignment.topCenter,
end: TextAlignment.bottomCenter,
colors: [Colors.black, Colors.transparent],
).createShader(Rect.fromLTRB(0, 0, rect.width, rect.height));
},
blendMode: BlendMode.dstIn,
child: FadeInImage.assetNetwork(
placeholder: "assets/placeholder.jpg",
image: globals.me["avatar"].replaceAll("\", ""),
),
),

当我调试此代码时,出现此错误:

The getter 'dstIn' isn't defined for the class 'BlendMode'.
Try importing the library that defines 'dstIn', correcting the name to the name of an existing getter, or defining a getter or field named 'dstIn'.

我找不到任何解决方案。我该如何解决这个问题?

未定义 getter,因为未定义类。此错误通常在未导入dart:ui时出现(在BlendMode的情况下(。
因此,请确保文件顶部有以下导入:

import 'dart:ui';

如果您在其他类中看到此错误,请找出该类(或此处enum(所属的库并将其导入。

最新更新