You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since the expected type of function parameters is already clearly defined and known (especially with named parameters), having to specify it when passing an enum identifier (EnumType.identifier) is quite redunant. This feature can further optimize Dart for UI by making passing widget attributes shorter and more readable.
To emphasize: all of the enum's instances will be available in the 'scope' of that one parameter, as if the current piece of code is contained inside the actual defenition of the enum class. This design also resolves possible name shadowing issues created by this feature; i.e. if a variable with the same name as one of the enum identifiers exists in the current scope, you could only access that identifier by refrencing the enum's name the normal way.
The text was updated successfully, but these errors were encountered:
yahel-ck
changed the title
Feature idea: enum paramters to not require class name prefix.
Feature idea: enum paramters should'nt require class name prefix.
Dec 13, 2019
yahel-ck
changed the title
Feature idea: enum paramters should'nt require class name prefix.
Feature idea: enum paramters shouldn't require class name prefix.
Dec 13, 2019
yahel-ck
changed the title
Feature idea: enum paramters shouldn't require class name prefix.
Feature idea: enum paramters shouldn't require enum name prefix.
Dec 13, 2019
Rationale
Since the expected type of function parameters is already clearly defined and known (especially with named parameters), having to specify it when passing an enum identifier (
EnumType.identifier
) is quite redunant. This feature can further optimize Dart for UI by making passing widget attributes shorter and more readable.Examle
Instead of:
You'd write:
To emphasize: all of the enum's instances will be available in the 'scope' of that one parameter, as if the current piece of code is contained inside the actual defenition of the enum class. This design also resolves possible name shadowing issues created by this feature; i.e. if a variable with the same name as one of the enum identifiers exists in the current scope, you could only access that identifier by refrencing the enum's name the normal way.
The text was updated successfully, but these errors were encountered: