Created
August 7, 2022 02:13
-
-
Save ailabs-software/238e9d53183bb053773621ac82917111 to your computer and use it in GitHub Desktop.
On line 15, how to break out of scope and reference dart String type?
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
enum DataType | |
{ | |
None(false, BASE_OPERATOR_TITLE_MAP), // Null or nil is this language. | |
Boolean(false, BASE_OPERATOR_TITLE_MAP), | |
Number(false, BASE_OPERATOR_TITLE_MAP), | |
String(false, BASE_OPERATOR_TITLE_MAP), | |
Date(false, BASE_OPERATOR_TITLE_MAP), | |
StringArray(true, BASE_OPERATOR_TITLE_MAP), // An array of strings | |
Object(false, BASE_OPERATOR_TITLE_MAP), // A catch-all type for objects types. | |
DateTime(false, BASE_OPERATOR_TITLE_MAP), | |
Anniversary(false, BASE_OPERATOR_TITLE_MAP); | |
final bool isArray; | |
final Map<OperatorType, String> operatorTitleMap; | |
const DataType(bool this.isArray, Map<OperatorType, String> this.operatorTitleMap); | |
} |
The real crime here is not naming enum members in lowerCamelCase
:D
That said, you can do this:
import 'dart:core' as core;
enum DataType
{
/* ... */;
final Map<OperatorType, core.String> operatorTitleMap;
const DataType(bool this.isArray, Map<OperatorType, String> this.operatorTitleMap);
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Why are you creating names that deliberately shadow names that already have significance?