getState method

StrippedStateEvent? getState(
  1. String typeKey, [
  2. String stateKey = ''
])

Returns the Event for the given typeKey and optional stateKey. If no stateKey is provided, it defaults to an empty string. This returns either a StrippedStateEvent for rooms with membership "invite" or a User/Event. If you need additional information like the Event ID or originServerTs you need to do a type check like:

if (state is Event) { /*...*/ }

Implementation

StrippedStateEvent? getState(String typeKey, [String stateKey = '']) =>
    states[typeKey]?[stateKey];