π¦
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
use crate::error::AppError; | |
use serde::{Deserialize, Serialize}; | |
use sqlx::{MySql, Pool, Row, FromRow}; | |
// Helper struct to handle database type conversions | |
#[derive(Debug, FromRow, Clone, Serialize, Deserialize)] | |
pub struct RawInventoryRow { | |
pub account_id: u32, | |
pub account: String, | |
pub source: String, |
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 'dart:collection'; | |
/// A simple mutex implementation using a queue of completers. | |
/// This allows for synchronizing access to a critical section of code, | |
/// ensuring that only one task can execute the critical section at a time. | |
class Mutext { | |
/// Creates a new instance of the mutex. | |
Mutext(); |
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:typed_data'; | |
import 'package:crypto/crypto.dart' as crypto; | |
import 'package:meta/meta.dart'; | |
@internal | |
abstract final class BytesUtil { | |
/// Extract hash from a [Uint8List] and convert it to a hex string. | |
static String sha256(Uint8List bytes) { | |
if (bytes.isEmpty) return 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'; |
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
/* | |
* Dart Utf8Decoder example | |
* https://gist.github.com/PlugFox/c82c6147ccac451faa55efa8b55c80ae | |
* https://dartpad.dev?id=c82c6147ccac451faa55efa8b55c80ae | |
* Mike Matiunin <[email protected]>, 22 April 2025 | |
*/ | |
// ignore_for_file: avoid_print | |
import 'dart: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 '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 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 '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 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
/* | |
* 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 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
/* | |
* 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 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
// 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 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
/// {@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({ |
NewerOlder