powerForChangingStateEvent method
returns the powerlevel required for chaning the action
defaults to
state_default if action
isn't specified in events override.
If there is no state_default in the m.room.power_levels event, the
state_default is 50. If the room contains no m.room.power_levels event,
the state_default is 0.
Implementation
int powerForChangingStateEvent(String action) {
final powerLevelMap = getState(EventTypes.RoomPowerLevels)?.content;
if (powerLevelMap == null) return 0;
return powerLevelMap
.tryGetMap<String, Object?>('events')
?.tryGet<int>(action) ??
powerLevelMap.tryGet<int>('state_default') ??
50;
}