简体   繁体   English

Flutter android 工作室的构造函数错误。 一直显示错误

[英]Flutter constructor error on android studio. It keeps showing error

enter image description here When I try to create a new class in the library of flutter, inside the class the constructor shows error在此处输入图像描述当我尝试在 flutter 的库中创建一个新的 class 时,在 class 中,构造函数显示错误

The problem is that you have your parameters as optionally named, which means the caller can decide not to pass q or a , but you also marked them as non-nullable.问题是您的参数是可选命名的,这意味着调用者可以决定不传递qa ,但您也将它们标记为不可为空。 Add the required keyword before your parameters to make sure they're passed in and are non-null, or add a default.在您的参数之前添加required关键字以确保它们已传入并且不为空,或者添加默认值。

Also, in the future:另外,未来:

  • Please copy-paste your code instead of using an image.请复制粘贴您的代码,而不是使用图像。 This lets us quickly copy-paste it into our IDEs and find any errors.这让我们可以快速将其复制粘贴到我们的 IDE 中并找出任何错误。
  • Please post the error you're getting.请发布您遇到的错误。 Errors are your friends, they tell you what's wrong, and they'll help us figure out how to help you.错误是您的朋友,它们会告诉您哪里出了问题,它们会帮助我们弄清楚如何帮助您。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM