This file contains hidden or 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:collection/collection.dart'; | |
final input = '''38665 13337 | |
84587 21418 | |
93374 50722 | |
68298 57474 | |
54771 18244 | |
49242 83955 | |
66490 44116 | |
65908 51323 |
This file contains hidden or 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
MyClass nonConstMyClass(int value) => MyClass(value); | |
void main() { | |
test('ValueEquality', (){ | |
final a = nonConstMyClass(1); | |
final b = nonConstMyClass(2); | |
expect(a, b); | |
}); | |
} |
This file contains hidden or 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
void main() { | |
test('Value equality', () { | |
const a = MyClass(1); | |
const b = MyClass(1); | |
expect(a, b); // The props is not invoked. | |
}); | |
} |
This file contains hidden or 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 Equatable { | |
/// {@macro equatable} | |
const Equatable(); | |
... | |
@override | |
bool operator ==(Object other) => | |
identical(this, other) || | |
other is Equatable && | |
runtimeType == other.runtimeType && |
This file contains hidden or 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 MyClass extends Equatable { | |
const MyClass(this.id); | |
final int id; | |
@override | |
List<Object> get props => [id]; | |
} |
This file contains hidden or 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 ConstantClass{ | |
const ConstantClass({ | |
required this.arg1, | |
required this.arg2, | |
required this.arg3, | |
}); | |
final int arg1; | |
final int arg2; | |
final int arg3; |
This file contains hidden or 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
empty |
This file contains hidden or 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
Widget _kDefaultWidget<T>(T value, BuildContext _) => Text('Error.'); | |
typedef BuilderFunction<T> = Widget Function(T value, BuildContext context); | |
typedef ListenerFunction<T> = void Function(T value, BuildContext context); | |
class MatchCase<Q> { | |
MatchCase( | |
this.matcher, | |
this.builder, |
This file contains hidden or 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 NewIntCaseWidget extends CaseWidget<int> { | |
NewIntCaseWidget({ | |
super.key, | |
required int super.value, | |
}) { | |
onEquals(0, (value, context) => Text('Value is zero')); | |
onEquals(1, (value, context) => Text('Value is 1')); | |
onLessThan(1, (value, context) => Text('Value is less than 1')); | |
onGreaterThan(1, (value, context) => Text('Value is greater than 1')); |
This file contains hidden or 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:injectable/injectable.dart'; | |
/// {@template app_environment} | |
/// Use [AppEnvironment] to provide/access some information about the Environment app is | |
/// running. | |
/// | |
/// Access [AppEnvironment] name with the [name] property. | |
/// | |
/// Currently has supported 3 environments: | |
/// 1. [AppEnvironment.development] : Use it for develop dependencies. This is |
NewerOlder