I keep seeing references to _internal in examples like the following:
class Symbol {
final String name;
static Map<String, Symbol> _cache;
factory Symbol(String name) {
if (_cache == null) {
_cache = {};
}
if (_cache.containsKey(name)) {
return _cache[name];
} else {
final symbol = new Symbol._internal(name);
_cache[name] = symbol;
return symbol;
}
}
Symbol._internal(this.name);
}
I've gathered from the code that it's a privately accessible constructor. The last line Symbol._internal(this.name);
seems a bit confusing because it appears to be a statement within the class body and not within a method body, leading me to believe it's actually the internal constructor definition without a method body.
Are my assumptions correct?
question from:https://stackoverflow.com/questions/11112506/what-are-the-semantics-of-internal