Flutter Tutorial

Abstraction

/// Abstraction
/// Hiding the complexity

class Remote {
  int _temp = 0;

  void increaseTemp() {
    _awakeRemoteSystem();
  }

  void decrementTemp() {
    _awakeRemoteSystem();
  }

  void _awakeRemoteSystem() {
    print('Awake System');
    _callArduino();
  }

  void _callArduino() {
    print('execute command');
    _communicateWithAC();
  }

  void _communicateWithAC() {
    print('Communicating with AC');
    _getResponse();
  }

  void _getResponse() {
    _temp = _temp + 1;
  }

  int get temp {
    return _temp;
  }
}
Scroll to Top