You cannot perform this operation as described by bool.parse('true') because the Dart SDK is as light as possible.
The Dart SDK is not as unified as, for example, the .NET Framework, where all the basic types of systems have the following unification.
IConvertible.ToBoolean IConvertible.ToByte IConvertible.ToChar IConvertible.ToDateTime IConvertible.ToDecimal IConvertible.ToDouble IConvertible.ToInt16 IConvertible.ToInt32 IConvertible.ToInt64 IConvertible.ToSByte IConvertible.ToSingle IConvertible.ToString IConvertible.ToUInt16 IConvertible.ToUInt32 IConvertible.ToUInt64
These types also have a parse method, including a Boolean type.
Therefore, you cannot do it in a unified way. Only one.
mezoni
source share