Dart には、エラー (左) またはオブジェクト (右) を伝播するためにどちらかの値を返したい関数があります。これらのデータは、Dart の this のような関数の別の Both 値に依存していますが、現在、入力の Each が (正しい) 値を返しているにもかかわらず、null を返しています。
Future<Either<Failure, User>> getUser(String uid) async {
Either<Failure, DocumentSnapshot> document;
document = await _database.getDocumentById(uid);
// _database.getDocument function returns a Either<Failure, Document> object
// But when I fold the value to propagate the failure or return an User, I get null as
//return
document.fold((failure) => Left(failure), (document) => Right(User.fromJson(document.data)));
}
User.fromJson 関数はテスト済みで正常に動作していますが、Either オブジェクトを返すことができません