#_currentArena 是什么? (句法)
What is #_currentArena? (Syntax)
我在flutter的ffi例子中arena.dart找到了这段代码:
/// The last [Arena] in the zone.
factory Arena.current() {
return Zone.current[#_currentArena];
}
我很困惑,找不到任何关于 #_currentArena
的东西。那是什么类型的语言结构,它是如何工作的?尝试命名任何以 #
开头的(其他)名称会立即出错;自动补全没有找到它,尝试去它的定义也不起作用。
所以这似乎是非常特别的东西,而且非常没有记录......让我非常好奇!
正如@pskink 在他的评论中指出的那样,这是 symbols.
的一部分
A Symbol object represents an operator or identifier declared in a
Dart program. You might never need to use symbols, but they’re
invaluable for APIs that refer to identifiers by name, because
minification changes identifier names but not identifier symbols.
To get the symbol for an identifier, use a symbol literal, which is
just # followed by the identifier:
#radix
#bar
Symbol literals are compile-time constants.
我在flutter的ffi例子中arena.dart找到了这段代码:
/// The last [Arena] in the zone.
factory Arena.current() {
return Zone.current[#_currentArena];
}
我很困惑,找不到任何关于 #_currentArena
的东西。那是什么类型的语言结构,它是如何工作的?尝试命名任何以 #
开头的(其他)名称会立即出错;自动补全没有找到它,尝试去它的定义也不起作用。
所以这似乎是非常特别的东西,而且非常没有记录......让我非常好奇!
正如@pskink 在他的评论中指出的那样,这是 symbols.
的一部分A Symbol object represents an operator or identifier declared in a Dart program. You might never need to use symbols, but they’re invaluable for APIs that refer to identifiers by name, because minification changes identifier names but not identifier symbols.
To get the symbol for an identifier, use a symbol literal, which is just # followed by the identifier:
#radix #bar
Symbol literals are compile-time constants.