tezvyn:

📱Mobile Dev

Mobile app development across platforms

351 bites

Android & Kotlin30 sec read

Coroutine Dispatchers: Telling Your Coroutines Which Thread to Use

A Dispatcher tells a coroutine which thread or thread pool to use for its work. Use `Dispatchers.Default` for CPU-intensive tasks. If none is specified, it inherits from its parent. The main footgun: `Unconfined` can resume on an unexpected thread.

Android & Kotlin30 sec read

Kotlin Sealed Classes: Enums for Types

A sealed class is like an enum, but for types. It defines a closed set of subclasses, letting each one carry different data. It's perfect for modeling states like `Loading`, `Success`, and `Error`, ensuring you handle every case at compile time.

Android & Kotlin30 sec read

Kotlin Scope Functions: Cleaner Code, Clearer Choices

Kotlin's scope functions (`let`, `run`, `apply`) create a temporary workspace for an object, avoiding repetitive variable names. Use them for object configuration or chaining calls.

Android & Kotlin30 sec read

Kotlin Extension Functions: Add Methods Without Inheritance

Kotlin extension functions let you add new functionality to existing classes without inheritance, as if you were adding a new method. They're perfect for creating helpers for third-party library classes or framework types like `String`.

Android & Kotlin30 sec read

Kotlin Data Classes: Automatic Boilerplate for Data Holders

A Kotlin `data class` automatically generates boilerplate like `equals()` and `toString()` for classes that just hold data. Use it for model objects or DTOs where value equality matters. The footgun: its `copy()` method is shallow, sharing mutable objects.

Android & Kotlin30 sec read

Kotlin Inheritance: Open for Extension, Closed by Default

In Kotlin, classes are final by default. Think of inheritance as an opt-in feature you enable with the `open` keyword. Use it to create specialized versions of a base class, like a `Student` from a `Person`.

Android & Kotlin30 sec read

Kotlin Functions: Named, Reusable Code Blocks

A function is a named recipe for your code. You give it ingredients (parameters) and it produces a result. They are used everywhere, from calculating values to handling button clicks.

Android & Kotlin31 sec read

Kotlin Null Safety: Catch Nulls at Compile Time

Kotlin's type system catches null pointer errors at compile time. Variables are non-nullable by default; you must opt-in to nulls with a `?` (e.g., `String?`). The compiler then forces you to handle the null case. The main footgun is the `!!` operator.

Android & Kotlin30 sec read

Kotlin Variables: `val` for Constants, `var` for Variables

In Kotlin, `val` creates a read-only constant you assign once, like a fixed setting. `var` creates a mutable variable you can change later. Always prefer `val` unless you explicitly need to reassign a value to prevent accidental state changes.

Flutter & Dart30 sec read

Riverpod 3 brings code-gen to every provider

Riverpod 3 standardises on the @riverpod annotation. The legacy StateProvider / ChangeNotifierProvider APIs are deprecated, and the runtime gets a 30% smaller binary footprint thanks to removing the manual scoping machinery.

Flutter & Dart30 sec read

Flutter 3.27 ships impeller on Android by default

The new release flips the Impeller renderer on for all Android devices, dropping Skia for Vulkan/OpenGL. Smoother scrolling, faster first frame, and far fewer jank reports — at the cost of a slightly larger APK.