Cannot understand how variable can be a function.
Sample code.
import 'dart:mirrors';
class Foo {
int baz;
}
void main() {
var name = "baz=";
var typeMirror = reflectClass(Foo);
for(var member in typeMirror.instanceMembers.values) {
print(MirrorSystem.getName(member.simpleName));
if(MirrorSystem.getName(member.simpleName) == name) {
if(member is MethodMirror) {
print("================================");
print("Info about METHOD $name");
print("isSetter: ${member.isSetter}");
print("isVariable: false, because it is a method");
print("================================");
}
}
}
}
==
hashCode
_identityHashCode
toString
noSuchMethod
runtimeType
_cid
_leftShiftWithMask32
baz
baz=
================================
Info about METHOD baz=
isSetter: true
isVariable: false, because it is a method
================================
I found this inforamtion in Wikipedia.
In object-oriented programming, an instance variable is a variable defined in a class (i.e. a member variable).
In object-oriented programming, a member variable (sometimes called a member field) is a variable that is associated with a specific class, and accessible for all its methods.
I also ask another question.
In object-oriented programming language Dart an instance variable (i.e. a member variable) is not a member of the instance? At least in the interpretation of "dart:mirrors" library.