简体   繁体   English

无效参数(输入):不得为 null

[英]Invalid argument(s) (input): Must not be null

Error I got: The following ArgumentError was thrown building FutureBuilder<List<Transaction>>(dirty, state: _FutureBuilderState<List<Transaction>>#b741e):
Invalid argument(s) (input): Must not be null
When the exception was thrown, this was the stack: 
#0      _RegExp.firstMatch (dart:core-patch/regexp_patch.dart:221:24)
#1      DateTime.parse (dart:core/date_time.dart:266:23)
#2      new transactionByDate (package:bug3t/widgets/transactionByDate.dart:16:20)
#3      _BudgetDateRangePickerState.build.<anonymous closure> (package:bug3t/widgets/date_picker.dart:80:19)
#4      _FutureBuilderState.build (package:flutter/src/widgets/async.dart:773:55)

#1 date_time.dart (lib) #1 date_time.dart (lib)

   static DateTime parse(String formattedString) {
        var re = _parseFormat;
        **Match? match = re.firstMatch(formattedString);**
    if (match != null) {
          int parseIntOrZero(String? matched) {
            if (matched == null) return 0;
            return int.parse(matched);
          }

#2 transactionByDate.dart( I use this one to filter transactions in JSON file) #2 transactionByDate.dart(我用这个来过滤 JSON 文件中的交易)

   class transactionByDate extends StatelessWidget {
      final List<Transaction> transactions;
      final DateTime from;
      final DateTime to;
      transactionByDate( this.transactions, this.from,  this.to) {
        for (int i = 0; i < transactions.length; i++) {
          **if (DateTime.parse(transactions[i].date).isAfter(this.to) || DateTime.parse(transactions[i].date).isBefore(this.from))** {
                 this.transactions.remove(transactions[i]);
                }
        }
      }

 

#3 date_picker.dart( I use this class to pass data from datepicker and JSON list fetched from the internet) #3 date_picker.dart(我使用这个 class 传递来自 datepicker 的数据和从 Internet 获取的 JSON 列表)

   child: new FutureBuilder<List<Transaction>>(
        future: fetchBudgetTrans(new http.Client()),builder: (context, snapshot) {if (snapshot.hasError) print(snapshot.error);
        if (snapshot.hasData) {
        **transactionByDate tl = new transactionByDate(snapshot.data,_fromDate,_toDate);** 
return Flexible(child: tl);} else return new Center(child: new CircularProgressIndicator()); },)
if(formattedString == null) 
    Do sth

暂无
暂无

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

相关问题 无效参数(输入):不得为 null - Flutter - Invalid argument(s) (input): Must not be null - Flutter Json 可序列化 - 无效参数(输入):不得为 null - Json Serializable - Invalid argument(s) (input): Must not be null 可迭代 toList() 抛出 - ArgumentError(无效参数(输入):不能为空) - Iterable toList() throws - ArgumentError (Invalid argument(s) (input): Must not be null) dio http 获取错误 ArgumentError(无效参数(输入):不得为空)flutter - dio http get error ArgumentError (Invalid argument(s) (input): Must not be null) flutter 未处理的异常:无效参数(值):不得为 null Flutter 2 - Unhandled Exception: Invalid argument(s) (value): Must not be null Flutter 2 Flutter 未处理的异常:无效参数(值):不得为 null - Flutter Unhandled Exception: Invalid argument(s) (value): Must not be null 该页面无法在我的 Flutter 应用程序中正确加载页面(已更新)无效参数:源不能为空 - The page can't load page correctly in my flutter app (UPDATED) Invalid argument(s): The source must not be null Flutter来自ADB的意外故障:无效参数:源不得为空在设备上启动应用程序时出错 - Flutter Unexpected failure from adb: Invalid argument(s): The source must not be null Error launching application on device 运行时出现Flutter项目,显示错误无效参数:源不得为null - Flutter project when run showing Error Invalid argument(s): The source must not be null Flutter Web:文件选择器抛出“无效参数(路径):不能为空”错误 - Flutter Web: File Picker throws 'Invalid argument(s) (path): Must not be null' error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM