According to the requirement, is it necessary to use getString(KEY_TOKEN, "").orEmpty()
instead of getString(KEY_TOKEN, "")
? The getString
function already defaults to an empty string (""
) and automatically returns an empty string if there is no value corresponding to the KEY_TOKEN
key or if it is an empty string.