execute method

Future<bool?> execute(
  1. String caller,
  2. String propertyOrFunction,
  3. List arguments
)

Implementation

Future<bool?> execute(
    String caller, String propertyOrFunction, List<dynamic> arguments) async {
  if (scope == null) return null;

  var function = propertyOrFunction.toLowerCase().trim();

  switch (function) {
    // set property
    case 'set':
      return set(this, caller, propertyOrFunction, arguments, scope!);

    // add child
    case 'addchild':
      addChild(this, arguments);

      // force rebuild
      notifyListeners("rebuild", true);

      return true;

    // remove child
    case 'removechild':
      removeChild(this, arguments);

      // force rebuild
      notifyListeners("rebuild", true);

      return true;

    // remove all children
    case 'removechildren':
      removeChildren(this, arguments);

      // force rebuild
      notifyListeners("rebuild", true);

      return true;

    // replace child
    case 'replacechild':
      replaceChild(this, arguments);

      // force rebuild
      notifyListeners("rebuild", true);

      return true;

    // replace all children
    case 'replacechildren':
      replaceChildren(this, arguments);

      // force rebuild
      notifyListeners("rebuild", true);

      return true;

    // remove me
    case 'removewidget':
      removeWidget(this, arguments);

      // force rebuild
      parent?.notifyListeners("rebuild", true);

      return true;

    // replace me
    case 'replacewidget':
      replaceWidget(this, arguments);

      // force rebuild
      parent?.notifyListeners("rebuild", true);

      return true;
  }

  return false;
}