Gist with code to build flutter apps easily
| import 'package:flutter/material.dart'; | |
| /// Flutter code sample for [CustomScrollView]. | |
| void main() => runApp(const CustomScrollViewExampleApp()); | |
| class CustomScrollViewExampleApp extends StatelessWidget { | |
| const CustomScrollViewExampleApp({super.key}); | |
| @override |
| import 'package:flutter_test/flutter_test.dart'; | |
| import 'package:async/async.dart'; | |
| class TestValue {} | |
| void main() { | |
| test('should call factory only once', () async { | |
| var callCount = 0; | |
| final asyncClass = Async(() async { | |
| callCount += 1; |
| App | |
| Coordinators // Views management | |
| UI // Grouped by features/viewHierarchy | |
| General // Custom textfield, picker | |
| FeatureA | |
| A.swift | |
| AView.swift | |
| AController.swift | |
| AppExtensions // Specific code for extensions | |
| Watch |
| -- AppleScript -- | |
| -- This example is meant as a simple starting point to show how to get the information in the simplest available way. | |
| -- Keep in mind that when asking for a `return` after another, only the first one will be output. | |
| -- This method is as good as its JXA counterpart. | |
| -- Chromium variants include "Google Chrome", "Chromium", "Opera", "Vivaldi", "Brave Browser", "Microsoft Edge". | |
| -- Specific editions are valid, including "Google Chrome Canary", "Microsoft Edge Dev". | |
| -- "Google Chrome" Example: | |
| tell application "Google Chrome" to return title of active tab of front window |
With so many other aspects of daily development completely unattainable by your average developer, exception handling is often ignore in lieu of bigger fish to fry. On the surface, exception handling appears sufficiently complicated enough that most developers have simply resolved to ignore it on a day-to-day basis or altogether. Only during the last weeks of development do they tack on a top-level try/catch block to avoid complete system failure or to log that "some" error occurred. Rather than a simple error dialog appearing to users, they are greeted with the "yellow screen of death". Even when the developer does manage to display an error dialog, the message is often vague or cryptic, e.g., "An error occurred".
We can do better than this. I believe the issue is that not a lot of focus has been given to providing simple, bare-minimum exception handling. For the majority of applications, exception handling only needs to satisfy the following requirements:
| extension UIImage { | |
| func qrCodes() -> [CIQRCodeFeature] { | |
| guard let image = CIImage(image: self) else { | |
| return [] | |
| } | |
| let detector = CIDetector( | |
| ofType: CIDetectorTypeQRCode, | |
| context: nil, | |
| options: [CIDetectorAccuracy: CIDetectorAccuracyHigh]) |
| extension on Object { | |
| Object operator | (Object some) {} | |
| Object operator & (Object some) {} | |
| Object operator + (Object some) {} | |
| Object operator - (Object some) {} | |
| Object operator * (Object some) {} | |
| Object operator / (Object some) {} | |
| Object operator ^ (Object some) {} | |
| Object operator >> (Object some) {} | |
| Object operator << (Object some) {} |
| import 'dart:async'; | |
| import 'package:quiver/core.dart'; | |
| import 'package:stack_trace/stack_trace.dart'; | |
| typedef AsValueProvider = Object Function(); | |
| Optional<T> asA<T>(AsValueProvider provider) { | |
| final handledExceptions = <CaughtException>[]; | |
| final providedValue = Chain.capture( |
| import 'package:flutter/rendering.dart'; | |
| //+───────────────────────────────────────────────────────────────────────── | |
| //+ Blue Grey | |
| //+───────────────────────────────────────────────────────────────────────── | |
| const blueGrey0 = Color.fromRGBO(240, 244, 248, 1); | |
| const blueGrey1 = Color.fromRGBO(217, 226, 236, 1); | |
| const blueGrey2 = Color.fromRGBO(188, 204, 220, 1); | |
| const blueGrey3 = Color.fromRGBO(159, 179, 200, 1); | |
| const blueGrey4 = Color.fromRGBO(130, 154, 177, 1); |