# setMessageSource abstract method

void setMessageSource(

1. MessageSource? messageSource

)

Sets the `MessageSource` that this component can use for message resolution.

This method is called by the framework when a MessageSource is available in the application context. The MessageSource may be null if no message source has been configured.

### Parameters:

- `messageSource`: The MessageSource instance, or null if not available

### Example:

    @override
    void setMessageSource(MessageSource? messageSource) {
      _messageSource = messageSource;
      if (_messageSource == null) {
        logger.warn('No MessageSource configured, using default messages');
      }
    }

## Implementation

    void setMessageSource(MessageSource? messageSource);