samedi 1 octobre 2016

Unsound implicit cast from dynamic to (dynamic) -> bool

While testing in a strict mode I can't come up with idea, how to fix Unsound implicit cast from dynamic to (dynamic) -> bool warning, while using notNullPredicate

Actually my code is following

static _mockSubscription(mockStore) {
var mappedStream = getStream();
var filteredStream = getStream();

var signUpMapPredicate = predicate((f) {
  var data = new SignUpData();
  var state = new State({'signUp': data});
  return f(state) == data;
});

when(mockStore.map(signUpMapPredicate)).thenReturn(mappedStream);
when(mappedStream.where(notNullPredicate)).thenReturn(filteredStream);
return filteredStream;

}

And I try to get this

notNullPredicate

somehow like that

import 'package:test/test.dart';

get notNullPredicate => predicate((f) => f(null) == false);

Aucun commentaire:

Enregistrer un commentaire