Skip to content

Instantly share code, notes, and snippets.

@elias8
elias8 / building-sync-systems.md
Created May 29, 2025 09:42 — forked from pesterhazy/building-sync-systems.md
Building an offline realtime sync engine

So you want to write a sync system for a web app with offline and realtime support? Good luck. You might find the following resources useful.

Overview articles

@elias8
elias8 / flutter_smooth_app_startup.dart
Created October 7, 2024 01:02
Flutter splash screen implementation for smoother app startup while loading essential dependencies.
import 'package:flutter/material.dart';
void main() => runApp(const Application());
class Application extends StatefulWidget {
const Application({super.key});
@override
State<Application> createState() => _ApplicationState();
}
@elias8
elias8 / name_tagging.dart
Created December 6, 2023 21:24 — forked from slightfoot/name_tagging.dart
Name Tagging during input example - by Simon Lightfoot - Humpday Q&A :: 6th December 2023 #Flutter #Dart - https://www.youtube.com/watch?v=TaHhT1QdYUM
// MIT License
//
// Copyright (c) 2023 Simon Lightfoot
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@elias8
elias8 / main.dart
Created May 12, 2023 18:12
Dart pattern matching possible bug.
sealed class A {
R whenOrNull<R>({
R Function()? a,
R Function()? b,
R Function()? c,
R Function(int value)? d,
required R Function() orElse,
}) {
return switch (this) {
A() when a != null => a(),
@elias8
elias8 / platform_is.dart
Created September 24, 2021 14:37 — forked from rydmike/platform_is.dart
Flutter Universal Platform Check - That Works on Web too
import 'universal_platform_web.dart'
if (dart.library.io) 'universal_platform_vm.dart';
/// A universal platform checker.
///
/// Can be used to check active physical Flutter platform on all platforms.
///
/// To check what host platform the app is running on use:
///
/// * PlatformIs.android
import 'package:flutter/material.dart';
void main() => runApp(const App());
class App extends StatelessWidget {
const App({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
@elias8
elias8 / fpmax.scala
Created January 10, 2021 20:31 — forked from jdegoes/fpmax.scala
FP to the Max — Code Examples
package fpmax
import scala.util.Try
import scala.io.StdIn.readLine
object App0 {
def main: Unit = {
println("What is your name?")
val name = readLine()
@elias8
elias8 / main.dart
Created October 21, 2020 21:23
Flutter Local FocuseScope
import 'package:flutter/material.dart';
void main() => runApp(Material(child: ExampleLocalFocusScope()));
class ExampleLocalFocusScope extends StatefulWidget {
_ExampleLocalFocusScope createState() => _ExampleLocalFocusScope();
}
class _ExampleLocalFocusScope extends State<ExampleLocalFocusScope> {
final _formKey = GlobalKey<FormState>();