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 ApiProvidersScope extends InheritedWidget { | |
const ApiProvidersScope({ | |
required final this.store, | |
required super.child, | |
}); | |
final ApiProviderStore store; |
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(List<String> args) { | |
awaitSerial(); //🚶♂️ slow running | |
awaitParallel(); //🚴♂️ fast running | |
} | |
Future<int> getTotalClients() => Future.delayed(const Duration(seconds: 2), () => 1500000); | |
Future<int> getTotalUsers() => Future.delayed(const Duration(seconds: 2), () => 1500000); | |
Future<void> awaitSerial() async { |
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 'dart:async'; | |
import 'package:bloc/bloc.dart'; | |
import 'package:bloc_concurrency/bloc_concurrency.dart'; | |
import 'package:freezed_annotation/freezed_annotation.dart'; | |
part 'timer_bloc.freezed.dart'; | |
@freezed | |
class TimerEvent with _$TimerEvent { |
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
/// https://gist.github.com/dened/3385fd713c1fffcd23057db44b9545c9 | |
/// https://dartpad.dev/3385fd713c1fffcd23057db44b9545c9 | |
typedef Inc = int Function(); | |
Inc intrementer() { | |
var i = 0; | |
return () { | |
i++; |
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:flutter/material.dart'; | |
import 'package:flutter/rendering.dart'; | |
class StampWidget extends StatelessWidget { | |
const StampWidget._({ | |
Key? key, | |
this.number, | |
this.title, |
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() { | |
final bar = Bar(); | |
print(bar.model.value); | |
bar.model.value = "test"; | |
print(bar.model.value); | |
bar.model = SomeModel('newModel'); | |
print(bar.model.value); |
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:flutter/foundation.dart'; | |
import 'package:flutter/material.dart'; | |
/// Дефолтный класс [_ElevatedButtonDefaultElevation] добавляет к elevation различные значения в зависимости от состояния кнопки | |
@immutable | |
class ZeroElevationProperty extends MaterialStateProperty<double> | |
with Diagnosticable { | |
ZeroElevationProperty(); | |
@override |
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
/* | |
* https://dartpad.dev/e15c0e0bc625f59e8c747ea9c1d82a8b | |
*/ | |
import 'dart:async'; | |
import 'package:flutter/material.dart'; | |
final ValueNotifier<bool> useFix = ValueNotifier<bool>(false); | |
const int payloadLength = 70000; |
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
public class UserModel { | |
private BehaviorSubject<User> subject = BehaviorSubject.create(); | |
public void setUser(User user) { | |
subject.onNext(user); | |
} | |
public Observable<User> getUser() { | |
return subject; | |
} |
NewerOlder