我在测试应用程序时发现错误:
PS C:\Expert1\Tvseries-master> flutter test --coverage
02:28 +26 -1: loading C:\Expert1\Tvseries-master\test\data\datasources\televisi_remote_data\televisi_remote_data_source_test.dart [E]
Failed to load "C:\Expert1\Tvseries-master\test\data\datasources\televisi_remote_data\televisi_remote_data_source_test.dart": type 'Null' is not a subtype of type 'bool'
package:ditonton/data/models/televisi_model/televisi_detail_model.dart 50:20 new TelevisiDetailResponse.fromJson
test\data\datasources\televisi_remote_data\televisi_remote_data_source_test.dart 118:52 main.<fn>
package:test_api Declarer.group
package:flutter_test/src/test_compat.dart 189:13 group
test\data\datasources\televisi_remote_data\televisi_remote_data_source_test.dart 116:3 main
错误的原因是什么?如何修复?
1条答案
按热度按时间epggiuax1#
在此文件
package:ditonton/data/models/televisi_model/televisi_detail_model.dart 50:20 new TelevisiDetailResponse.fromJson
中,某个字段需要布尔值,但收到的是空值。您可以通过使布尔字段可为空来修复此问题。示例:bool? isWorking;