aboutyou / dart_packages

Dart and Flutter plugins maintained and used by @ABOUTYOU
220 stars 149 forks source link

[sign_in_with_apple] Replace static methods with instance methods #149

Open klisiewicz opened 3 years ago

klisiewicz commented 3 years ago

Issue

The major problem with static methods is testability. Static methods are impossible to tests since they cannot be mocked by Mockito.

Right now the only way of testing code that uses SignInWithApple is to mock SignInWithApple.channel which breaks hermetisation, reveals implementation details and seems to be very low level.

Solution

Convert SignInWithApple to a singleton and change static methods to instance methods.

HenriBeck commented 3 years ago

Sounds like a good improvement, though we might not have immediate time for this, we are always happy to accept a PR for this.

ivanthz commented 3 years ago

@klisiewicz good point. Same problem here.

vousmeevoyez commented 1 year ago

any example ?