Latin1Data.unsafe constructor
Latin1Data.unsafe(
- String from
Unsafely creates a Latin1Data
instance from a String
.
Throws an ArgumentError
if the input is not a valid Latin-1 encoded string.
@param from the String
to create the Latin1Data
from
@return the Latin1Data
@throws ArgumentError when the input string is not a valid Latin-1 encoding.
Implementation
factory Latin1Data.unsafe(String from) {
final result = Latin1Data.validated(from);
if (result.value == null) {
throw ArgumentError('Invalid Latin-1 string');
} else {
return result;
}
}