π¦
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:convert'; | |
import 'package:http/http.dart' as http; | |
import 'package:l/l.dart'; | |
/// Creates a stream of server-sent events (SSE) from the given URL. | |
/// The stream will emit events as a tuple of event name and data. | |
Stream<({String event, Map<String, Object?> data})> sse( | |
String url, { |
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:convert'; | |
import 'dart:math' as math; | |
import 'package:dio/dio.dart'; | |
import 'package:l/l.dart'; | |
/// A type alias for a server sent event (SSE) pair. | |
/// This is a tuple that contains the event name and the data associated with it. | |
typedef SSEPair = ({String event, Map<String, Object?> 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
/* | |
* Chat bubbles with input field V2 | |
* https://gist.github.com/PlugFox/30097d608f08dfd97e8dc7589bda4f07 | |
* https://dartpad.dev?id=30097d608f08dfd97e8dc7589bda4f07 | |
* Mike Matiunin <[email protected]>, 02 April 2025 | |
*/ | |
import 'dart:async'; | |
import 'package:flutter/foundation.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
/* | |
* Declarative Navigation | |
* A simple declarative navigation system for Flutter. | |
* https://gist.github.com/PlugFox/aaa2a1ab4ab71b483b736530ebb03894 | |
* https://dartpad.dev?id=aaa2a1ab4ab71b483b736530ebb03894 | |
* Mike Matiunin <[email protected]>, 14 March 2025 | |
*/ | |
import 'dart:async'; | |
import 'dart:collection'; |
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
// ignore_for_file: avoid_print | |
/* | |
* Date <==> Int conversion | |
* https://gist.github.com/PlugFox/a94be8655b2adb91336f03bc77513d76 | |
* https://dartpad.dev?id=a94be8655b2adb91336f03bc77513d76 | |
* Mike Matiunin <[email protected]>, 20 March 2025 | |
*/ | |
/// Date extension type |
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
/// {@template property_widget} | |
/// Widget to display a property with a label and a value. | |
/// [label] β’ β’ β’ β’ β’ [value] | |
/// | |
/// Tip: Use `DefaultTextStyle` to customize the underlying text style. | |
/// Tip: User `FittedBox` to downscale the size of form at limited space. | |
/// {@endtemplate} | |
class PropertyWidget extends StatelessWidget { | |
/// {@macro property_widget} | |
const PropertyWidget({ |
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
/* | |
* CustomClipper with MultiChildLayoutDelegate | |
* https://gist.github.com/PlugFox/d9e36528326d59f3429d131e610bf315 | |
* https://dartpad.dev?id=d9e36528326d59f3429d131e610bf315 | |
* Mike Matiunin <[email protected]>, 27 February 2025 | |
*/ | |
import 'dart:async'; | |
import 'dart:math' as math; |
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' show Future, Zone, scheduleMicrotask; | |
final Object _deferredPushKey = Object(); | |
/// Defers the given [callback] function to be executed after the current zone. | |
/// The callback will be executed in the reverse order of their registration. | |
void defer(void Function() callback) { | |
final push = Zone.current[_deferredPushKey]; | |
if (push is void Function(void Function() callback)) { | |
push(callback); |
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
{ | |
"status": "ok", | |
"data": { | |
"from": "2025-02-17T15:51:19.647Z", | |
"to": "2025-02-24T15:51:19.647Z", | |
"active": [ | |
{ | |
"cid": -1001782660763, | |
"users": [ | |
{ |
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 type const Date.of(DateTime _date) implements DateTime { | |
Date(int year, int month, int day) : _date = DateTime(year, month, day); | |
Date.now() : _date = DateTime.now(); | |
Date.value(int value) : _date = DateTime((value >> 9), (value >> 5) & 0xF, value & 0x1F); | |
int get value => (_date.year << 9) | (_date.month << 5) | _date.day; | |
} |
NewerOlder