swift<T> function

Rx<T> swift<T>(
  1. T value, {
  2. String? name,
})

Creates an Rx with optional type inference.

Usage with automatic inference: swift(0) creates Rx<int>. Usage with explicit type: swift<int>(0) creates Rx<int>. Usage for models: swift<MyModel>(myModel) creates Rx<MyModel>.

Example:

final counter = swift(0);        // Automatically Rx<int>
final name = swift('Hello');     // Automatically Rx<String>
final user = swift<User>(user);  // Explicit type for models

Implementation

Rx<T> swift<T>(T value, {String? name}) => Rx<T>(value, name: name);