type 'int' 不是 type 'double' 的子类型 flutter

type 'int' is not a subtype of type 'double' flutter

class H extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
   child:   stack(context, 'assets/sbg.png', 80, 111, 58, 215, 'assets/logo.png', 'title', 'subtitle'),
    );
  }
}

//////////


 Widget stack(BuildContext context,image, left,top,height,width,logo,title,subtitle){
  return Stack(
          clipBehavior: Clip.none,
          children: [
            Positioned(
                left: createSize( left, context),
                top: createSize(top, context),
                height: createSize(height, context),
                width: createSize(width, context),
                child: Column(children: [
                   Image.asset(logo),
               Text(title,style: TextStyle(),),Text(subtitle),
                ],),
                
               ),
            Container(
              height: createSize(447, context),
              width: createSize(375, context),
              decoration: BoxDecoration(
                image: DecorationImage(
                    image: AssetImage(image), fit: BoxFit.cover),
              ),
            ),
          ],
        );
}

我的 flutter 应用程序遇到了这个问题。 我总是收到这样的错误“type 'double' is not a subtype of type 'int' in type cast”,我在这里犯了什么错误? 构建 SignIn(dirty) 时抛出了以下 _TypeError: 类型 'int' 不是类型 'double'.

的子类型

要修复此错误,您只需将 .0 添加到代码中的每个数字即可。例如,如果你有 500 把它变成 500.0.

发生这种情况是因为 500int500.0double 并且它们是不同的类型。

int 用于存储整数,例如:500.

double用于存储带小数点的数字:如:1.618.