updateContext<T> method

void updateContext<T>(
  1. String key,
  2. T value
)

Update context with key and value

key the name for the context (attribut) value can be int, double, String or boolean otherwise the update context skip with warnning log

Implementation

void updateContext<T>(String key, T value) {
  var oldContext = Map.fromEntries(_context.entries);

  /// Delegate the action to strategy to update
  _visitorDelegate.updateContext(key, value);
  // Check the eqaulity before raise the warning
  if (mapEquals(oldContext, _context) == false) {
    // if the context still the same then no need to raise the warning
    // Update flagSyncStatus to raise a warning when access to flag
    this._flagSyncStatus = FlagSyncStatus.CONTEXT_UPDATED;
  }
}