1. @override
dynamic noSuchMethod(Invocation invocation)

Invoked when a non-existent method or property is accessed.

Classes can override noSuchMethod to provide custom behavior.

If a value is returned, it becomes the result of the original invocation.

The default behavior is to throw a NoSuchMethodError.

Source

@override
dynamic noSuchMethod(Invocation invocation) {
  if (invocation.isGetter) {
    var propertyName = MirrorSystem.getName(invocation.memberName);
    return this[propertyName];
  } else if (invocation.isSetter) {
    var propertyName = MirrorSystem.getName(invocation.memberName);
    propertyName = propertyName.substring(0, propertyName.length - 1);

    var value = invocation.positionalArguments.first;
    this[propertyName] = value;
    return null;
  }

  return super.noSuchMethod(invocation);
}