google / google/built_value.dart
Is it possible to extend an abstract superclass that extends another abstract class?
- Dominant language
- Dart
- Stars
- 886
- Forks
- 195
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 4
Description
I'm trying to convert my child class as a Built Class. There's no error when generating the builder but there's error when running the project.
My structure is like this:
I have an abstract class which is also the parent class:
```
abstract class ParentClass
extends CompactAction {
static Repo _repository;
static repository(Repo repository) {
_repository = repository;
}
}
```
`CompactAction` is an abstract class from redux_compact library: https://github.com/omaroskars/redux_compact/blob/master/lib/src/models.dart
I am creating my built class like below:
```
abstract class ChildClass extends Object
with
ParentClass
implements
Built {
ChildClass._();
factory ChildClass(
[Function(ChildClassBuilder) updates]) =
_$ChildClass;
@override
AnotherAbstractClass reduce() {
.........
.......
}
}
```
When I run the build_runner, there's no error. but when i Run the project, I got these errors below:
```
ib/src/compact_actions.g.dart:9:7: Error: The non-abstract class '_$ChildClass' is missing implementations for these members:
- CompactAction.after
- CompactAction.before
- CompactAction.dispatch
- CompactAction.request
- CompactAction.setRequestStatus
- CompactAction.setStore
- CompactAction.state
- CompactAction.store
Try to either
- provide an implementation,
- inherit an implementation from a superclass or mixin,
- mark the class as abstract, or
- provide a 'noSuchMethod' implementation.
class _$ChildClass
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../../../../../../.pub-cache/hosted/pub.dartlang.org/redux_compact-0.3.1/lib/src/models.dart:42:8: Context: 'CompactAction.after' is defined here.
void after() {}
^^^^^
../../../../../../.pub-cache/hosted/pub.dartlang.org/redux_compact-0.3.1/lib/src/models.dart:39:8: Context: 'CompactAction.before' is defined here.
void before() {}
^^^^^^
../../../../../../.pub-cache/hosted/pub.dartlang.org/redux_compact-0.3.1/lib/src/models.dart:21:20: Context: 'CompactAction.dispatch' is defined here.
Dispatch get dispatch => _store.dispatch;
^^^^^^^^
../../../../../../.pub-cache/hosted/pub.dartlang.org/redux_compact-0.3.1/lib/src/models.dart:30:21: Context: 'CompactAction.request' is defined here.
RequestStatus get request => _requestStatus;
^^^^^^^
../../../../../../.pub-cache/hosted/pub.dartlang.org/redux_compact-0.3.1/lib/src/models.dart:15:8: Context: 'CompactAction.setRequestStatus' is defined
```
I've also tried the examples in polymorphism.dart but it still shows the error. Is there any workaround to this? Thanks!
Contributor guide
Assessment
This issue has not been assessed yet.