【问题标题】:getting this error -> type 'Null' is not a subtype of type 'Widget收到此错误 -> 类型“Null”不是“Widget”类型的子类型
【发布时间】:2021-11-23 12:54:57
【问题描述】:
  _buildPincode()  {
    final _pcode =  getUserLocation(_areaname);
    FutureBuilder<Widget>(
        builder: (context, snapshot)  {
      return TextFormField(
          decoration: InputDecoration(labelText: 'Pincode'),
    onSaved: (String? _pcode){
    _pincode = _pcode!;
    }
  }

我正在尝试使用用户将输入的区域名称来获取密码

【问题讨论】:

  • 哪一行给你这个错误?
  • 请指出哪一行实际上引发了这个错误?
  • 请澄清您的具体问题或提供其他详细信息以准确突出您的需求。正如目前所写的那样,很难准确地说出你在问什么。

标签: flutter dart future


【解决方案1】:

这是因为您没有在_buildPincode 中返回任何内容:

_buildPincode() {
  final _pcode =  getUserLocation(_areaname);
  return FutureBuilder<Widget>(builder: (context, snapshot) {
    return TextFormField(
        decoration: InputDecoration(labelText: 'Pincode'),
        onSaved: (String? _pcode) {
          _pincode = _pcode!;
        });
  });
}

【讨论】:

    猜你喜欢
    • 2021-10-09
    • 2021-02-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-10-21
    • 2023-03-30
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多