Created
June 13, 2021 11:41
-
-
Save pasindud/e7fab65f0126c5706a7e9364a4653e47 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ClassName { | |
factory ClassName(Object complicatedObject) => ClassName.internal( | |
complicatedObject, | |
// Creation of this object is handled in the constructor | |
Object(), | |
); | |
@visibleForTesting | |
ClassName.internal( | |
this._complicatedObject, | |
this._complicatedObject2, | |
); | |
// Never every directly create a new object here | |
// All objects should be set from | |
// ClassName.internal() | |
final Object _complicatedObject; | |
final Object _complicatedObject2; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment