Open popeyelau opened 4 years ago
Tuple
const t = const Tuple2<String, int>('a', 10); print(t.item1); // prints 'a' print(t.item2); // prints '10'
Either & Option
///Either Either<SomeException, int> testEither(int code) { if (code >= 100) return Right(200); return Left(SomeException("不能小于 100")); } final result = testEither(100); print(result.isRight); //true print(result.isLeft); //false; result.fold((lhs) => print(lhs), (rhs) => print(rhs));
Tuple
Either & Option