【发布时间】:2021-08-07 22:21:37
【问题描述】:
Null* 获取任何 包:mockito/src/mock.dart
匹配在“this”位置传递的任何参数的参数匹配器。
参数类型“Null*”不能分配给参数类型“Params”.dart(argument_type_not_assignable)
test('should start listening when StartListening is called', () async {
final tStreamListHazardEntity =
Stream<List<HazardEntity>>.fromIterable([tListHazardEntity]);
// arrange
when(mockHazardListen!.call(any))
.thenAnswer((_) async => Right(tStreamListHazardEntity));
// assert
expectLater(
bloc,
emitsInOrder([
isA<HazardMasterInitial>(),
isA<Loading>(),
isA<UpdateState>()
]));
// act
bloc!.add(StartListening());
await untilCalled(mockHazardListen!.call(any));
// assert
verify(mockHazardListen!.call(any)); });
【问题讨论】:
标签: flutter mockito flutter-test