Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code quality improvements #38

Open
ciriousjoker opened this issue Jan 21, 2023 · 1 comment
Open

Code quality improvements #38

ciriousjoker opened this issue Jan 21, 2023 · 1 comment
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@ciriousjoker
Copy link
Contributor

Here are minor improvements that don't warrant their own Github issue, but that would make this package align more with the rest of the Dart ecosystem.

Please don't waste your time on these, the other issues are way more important.

Hide constructor

Chargebee() shouldn't be accessible, since everything is static anyway.
You can hide the constructor via

class Chargebee {
  Chargebee._(); 
  ...

Override toString() to make objects easily loggable:

final result = await Chargebee.purchaseProduct(...);
print(result);
logToCrashlytics(result.toString());

Use named parameters for the methods:

await Chargebee.configure("...", "...", "...", "..."); // <-- which of these is the android sdk key?
await configure(
  site: "...",
  apiKey: "...",
  androidSdkKey: "...", // <-- this can be removed without potentially passing null in a random place in the arglist
  iosSdkKey: "...",
);

PurchaseResult.status should be an enum:

Yes, you can google and search for valid values in the website documentation, but its faster to have your code editor autocomplete everything or at least spit out the inline documentation (which is also missing: #37).

ciriousjoker added a commit to dieringe/chargebee-flutter that referenced this issue Jan 22, 2023
@cb-amutha cb-amutha added the documentation Improvements or additions to documentation label May 17, 2023
@cb-amutha
Copy link
Contributor

@ciriousjoker thanks for your PR for our SDK improvements and it would help us and means a lot. will go through that PR and update them accordingly.

@cb-amutha cb-amutha self-assigned this May 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants