Obtain a MainCoroutineDispatcher.immediate, and if not supported by the current platform, fall back to a default MainCoroutineDispatcher.
Catches exceptions only, rethrowing any throwables
Get the name of the class, removing the "State" suffix, if present.
Cast this to type T or return null.
Do the operation on this if the type of this is T, and return R, otherwise return this