程序问答   发布时间:2022-06-02  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了无效参数(输入):不能为空大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

如何解决无效参数(输入):不能为空?

开发过程中遇到无效参数(输入):不能为空的问题如何解决?下面主要结合日常开发的经验,给出你关于无效参数(输入):不能为空的解决方法建议,希望对你解决无效参数(输入):不能为空有所启发或帮助;
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      datetiR_812_11845@e.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)

   static datetiR_812_11845@e 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( 我用这个来过滤交易 JsON 文件)

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

 

#3 date_picker.dart(我使用这个类来传递来自 datepicker 的数据和从互联网上获取的 JsON 列表)

   child: new FutureBuilder<List<transaction>>(
        future: fetchBudgetTrans(new @R_618_10107@.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

大佬总结

以上是大佬教程为你收集整理的无效参数(输入):不能为空全部内容,希望文章能够帮你解决无效参数(输入):不能为空所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。