Skip to content

Add const constructor to None and getOrNull to Option#9

Open
eEQK wants to merge 3 commits into
cbyad:masterfrom
eEQK:master
Open

Add const constructor to None and getOrNull to Option#9
eEQK wants to merge 3 commits into
cbyad:masterfrom
eEQK:master

Conversation

@eEQK
Copy link
Copy Markdown

@eEQK eEQK commented May 11, 2022

This PR consists of 2 commits:

  1. Add const constructor to None

Allows for specifying None as default constructor parameter:

class Foo {
  Foo({
    Option<String> param = const None(),
  });
}
  1. Add getOrNull method to Option

This one's pretty self-explanatory, as seen in tests:

/// getOrNull
expect(a.getOrNull(), null);
expect(b.getOrNull(), 2);

@eEQK
Copy link
Copy Markdown
Author

eEQK commented Sep 3, 2022

Hey @cbyad, is there anything missing? any chance you could merge or reject this PR? Thanks in advance 🥰

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant