Line data Source code
1 : import 'package:rx_bloc/rx_bloc.dart'; 2 : 3 : /// Just a simple container of 4 : /// [ErrorWithTag.exception] and [ErrorWithTag.tag] 5 : class ErrorWithTag { 6 : /// Default constructor 7 1 : ErrorWithTag({ 8 : required this.exception, 9 : this.tag = '', 10 : }); 11 : 12 : /// Constructor that creates an instance from [ResultError] 13 2 : factory ErrorWithTag.fromResult(ResultError resultError) => ErrorWithTag( 14 1 : exception: resultError.error, 15 1 : tag: resultError.tag, 16 : ); 17 : 18 : /// Is loading flag that is used in async operations 19 : final Exception exception; 20 : 21 : /// A tag that holds the intention of a async result 22 : final String tag; 23 : 24 0 : @override 25 0 : String toString() => '{loading: exception, tag: $tag}'; 26 : 27 0 : @override 28 : bool operator ==(dynamic other) { 29 0 : if (other is! ErrorWithTag) { 30 : return false; 31 : } 32 : 33 0 : return other.exception == exception && other.tag == tag; 34 : } 35 : 36 0 : @override 37 0 : int get hashCode => tag.hashCode ^ exception.hashCode; 38 : }