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:flutter/material.dart'; | |
import 'package:go_router/go_router.dart'; | |
void main() => runApp(const MyApp()); | |
/// The route configuration. | |
final GoRouter _router = GoRouter( | |
routes: <RouteBase>[ | |
GoRoute( |
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
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file | |
// for details. All rights reserved. Use of this source code is governed by a | |
// BSD-style license that can be found in the LICENSE file. | |
import 'package:flutter/material.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override |
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 _SelectValueNotifier<R, T> extends ValueNotifier<R> { | |
_SelectValueNotifier(this.source, this.selector) | |
: super(selector(source.value)) { | |
source.addListener(_sourceListener); | |
} | |
final ValueNotifier<T> source; | |
final R Function(T value) selector; | |
void _sourceListener() => value = selector(source.value); |
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:convert'; | |
import 'package:flutter/material.dart'; | |
import 'package:flutter/widgets.dart'; | |
import 'package:stream_chat/stream_chat.dart'; | |
class MessageInputController extends ValueNotifier<Message> { | |
/// Creates a controller for an editable text field. | |
/// | |
/// This constructor treats a null [message] argument as if it were the empty |
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 EventSyncHelper { | |
void startSession(); | |
Future<void> sendEvent(Event event); | |
Future<VoidResult> syncRemainingEvents(); | |
void endSession(); | |
} |
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 Streamable<T> extends Subject<T> implements ValueStream<T> { | |
Streamable(this._subject) : super(_subject, _subject); | |
final BehaviorSubject<T> _subject; | |
@override | |
Subject<R> createForwardingSubject<R>({ | |
void Function()? onListen, | |
void Function()? onCancel, | |
bool sync = false, |
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'; | |
import 'dart:collection'; | |
import 'package:meta/meta.dart'; | |
/// A listener that can be added to a [EventEmitter] using | |
/// [EventEmitter.on] or [EventEmitter.addListener]. | |
/// | |
/// This callback gets invoked once we call [EventEmitter.emit]. | |
typedef Listener<T> = void Function(T data); |
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'; | |
import 'package:rxdart/rxdart.dart'; | |
class StreamDebounce { | |
final Function func; | |
final Duration interval; | |
final subject = PublishSubject<List<dynamic>>(); | |
StreamSubscription subscriber; |
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'; | |
/// Signature for for the static method [Function.apply]. | |
typedef ApplicableFunction = void Function( | |
List<dynamic> positionalArguments, { | |
Map<Symbol, dynamic> namedArguments, | |
}); | |
/// Useful rate limiter extensions for [Function] class. | |
extension RateLimit on Function { |
NewerOlder