Skip to content

Instantly share code, notes, and snippets.

View sunderee's full-sized avatar

Peter Aleksander Bizjak sunderee

View GitHub Profile
@sunderee
sunderee / try_catch.dart
Created February 24, 2025 12:43
Native Dart helpers that use records to return the result or thrown error/exception object.
(T?, Object?) tryCatch<T extends Object>(T Function() function) {
try {
final result = function.call();
return (result, null);
} catch (error) {
return (null, error);
}
}
Future<(T?, Object?)> tryCatchAsync<T extends Object>(
@sunderee
sunderee / Makefile
Last active March 8, 2025 06:34
General Makefile that can be used for development of Flutter applications
.PHONY: help cleanup run-build-runner run-ios build-ios build-android build-android-apk
.DEFAULT_GOAL := help
BLUE := \033[34m
RESET := \033[0m
help: ## Show this help message
@echo 'Usage:'
@echo ' make [target]'
@echo ''