Improving on the refactoring in the clean code talk on inheritance, polymorphism, and testing by going from an inheritance approach to a composition approach.
Files should be read in order switch -> inheritance -> composition.
import 'dart:math'; | |
final random = new Random(); | |
void main() { | |
var isString; | |
if (random.nextBool()) { | |
isString = 'It is a string'; | |
isString.notAMethod(); // Analyzer sees a String | |
} else { |
Improving on the refactoring in the clean code talk on inheritance, polymorphism, and testing by going from an inheritance approach to a composition approach.
Files should be read in order switch -> inheritance -> composition.
Typing the right side of an assignment results in 'Info' lines from the analyzer. Typing the left side of an assignment results in 'Warning' lines from the anlayzer.
Proof of concept for using mixin to decorate with delegation rather than inheritance (the pattern I normally see)
Proof of concept for holding off a stream.listen callback until a trigger Future completes.
Proof of concept for implementing Reactive Programming Buffer and Throttle semantics on Dart Streams