asbool library

A simple tool to convert a dart object, including null, in a bool (true|false), quite similar to how works the double NOT operator !! in Javascript and Typescript.

This lib can be used like a helper method (asBool(value)), like an extension property (<any>.asBool) or like an operator (~~<any>).

Classes

BoolHelper
Helper class with a single method to convert a dynamic object to a bool

Extensions

WhateverToBoolExtension on dynamic
Extension to add the property .asBool to everything in dart
WhateverToBoolOperator on dynamic
Extension to add the operator ~ to everything in dart except int objects

Constants

asBool → const bool Function(dynamic value)
Public helper method for friendly use of the original BoolHelper.convertToBool