View main.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:async'; | |
typedef Listener = void Function(); | |
int _actionsProcessing = 0; | |
Set<Observable>? _currentReactives; | |
Set<Observable>? _scheduledReactives; | |
class Observable<T> { | |
Observable(T initialValue) : _value = initialValue; |
View main.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// --------------------------------------------------------------------------------- // | |
/// GENERATED ---> /// | |
class _ResultBaseModel<T> { | |
_ResultBaseModel({required this.value}); | |
T value; | |
} | |
abstract class Result<T> implements ISerializable { |
View main.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension on int? { | |
p() => print('int, ${this.runtimeType}'); | |
} | |
extension on Null { | |
p() => print('null'); | |
} | |
const _defaultNull = null; | |
// class Ii implements int {} | |
View main.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@sealed | |
abstract class _CarPart { | |
Engine(int cylinders, int horsepower); | |
Transmission(int gears, bool isManual); | |
} | |
class Car { | |
const Car( | |
this.model, { | |
required this.parts, |
View main.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class CarPart {} | |
class Engine implements CarPart { | |
const Engine({ | |
required this.cylinders, | |
required this.horsepower, | |
}); | |
final int cylinders; | |
final int horsepower; | |
} |
View main.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CarPart { | |
const CarPart(); | |
// METHOD COULD BE GENERATED | |
T match<T>({ | |
required T Function(Engine v) engine, | |
required T Function(Transmission v) transmission, | |
}) { | |
// ignore_for_file: curly_braces_in_flow_control_structures | |
if (this is Engine) return engine(this as Engine); |
View main.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class CarPart {} | |
class Engine implements CarPart { | |
const Engine({ | |
required this.cylinders, | |
required this.horsepower, | |
}); | |
final int cylinders; | |
final int horsepower; | |
} |
View main.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class CarPart { | |
CarPartType get type; | |
} | |
enum CarPartType<T extends CarPart> { | |
engine<Engine>(), | |
transmission<Transmission>(), | |
} | |
class Engine implements CarPart { |
View main.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CarPart { | |
const CarPart(this.type); | |
final CarPartType type; | |
} | |
enum CarPartType<T extends CarPart> { | |
engine<Engine>(), | |
transmission<Transmission>(), | |
} |
View main.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:data_classes/data_classes.dart'; | |
import 'package:common/const.dart'; | |
part 'change_log.g.dart'; | |
typedef FieldValueGetter<T> = T Function(dynamic); | |
enum EntityType { | |
series, |
NewerOlder