Skip to content

Commit c064f9b

Browse files
committed
Removed method canDecode.
1 parent 835dce1 commit c064f9b

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

lib/src/decoder/decoder.dart

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
1-
import 'package:analyzer/dart/constant/value.dart' show DartObject;
1+
import 'package:analyzer/dart/constant/value.dart';
22
import 'package:exception_templates/exception_templates.dart' show ErrorOf;
33

4-
import '../type/type_utils.dart';
5-
64
abstract class Decoder<T> {
75
const Decoder();
86

9-
/// Returns `true` if this decoder can read instances of
10-
/// [DartObject] representing type [S], and `false` otherwise.
11-
bool canDecode<S>() => isSubType<S, T>();
12-
137
/// Attempts to create an instance of [T] with information read from
14-
/// [obj].
8+
/// the constant [obj].
159
///
1610
/// Should throw [ErrorOf] with type argument [Decoder] with type argument
1711
/// [T] if an instance of [T] cannot be read from [obj].
@@ -20,7 +14,10 @@ abstract class Decoder<T> {
2014
/// Returns the generic type of the decoder.
2115
Type get type => T;
2216

23-
/// Error thrown if [obj] does not hold a variable of type [T].
17+
/// Returns an instance of [ErrorOf] with type argument [Decoder]
18+
/// with type argument [T].
19+
/// Classes extending [Decoder] of [T] may throw the result of [readError]
20+
/// if [obj] does not hold a variable of type [T].
2421
ErrorOf<Decoder<T>> readError(DartObject obj) {
2522
return ErrorOf<Decoder<T>>(
2623
message: 'Error reading const <$T> value.',
@@ -32,4 +29,7 @@ abstract class Decoder<T> {
3229
'constant with type <$T>.',
3330
);
3431
}
32+
33+
@override
34+
String toString() => '$runtimeType()';
3535
}

0 commit comments

Comments
 (0)