isValueType function

bool isValueType(
  1. dynamic value
)

Just a utility function to make sure if the state type implements equality (by default dart classes only support referential equality).

This library will not work if equality is not implemented. If you are manually overriding == and hashCode for your classes instead of using Equatable or Built, then you have to set Bloc.checkIfValueType to false, to avoid getting false errors.

Implementation

bool isValueType(value) {
  return (!Bloc.checkIfValueType ||
      value is num ||
      value is String ||
      value is DateTime ||
      value is bool);
}