Device class
A virtual device that will rendered when a story is previewed
- Annotations
-
- @freezed
Constructors
- Device({required String name, required Resolution resolution, required DeviceType type})
-
Creates a new device with
name
,resolution
, andtype
.constfactory - Device.desktop({required String name, required Resolution resolution, @Default(DeviceType.desktop) DeviceType type})
-
Creates a new desktop device
constfactory
- Device.mobile({required String name, required Resolution resolution, @Default(DeviceType.mobile) DeviceType type})
-
Creates a new mobile device
constfactory
- Device.special({required String name, required Resolution resolution, @Default(DeviceType.unknown) DeviceType type})
-
Creates a new special device which does not fit into the other categories
constfactory
- Device.tablet({required String name, required Resolution resolution, @Default(DeviceType.tablet) DeviceType type})
-
Creates a new tablet device
constfactory
- Device.watch({required String name, required Resolution resolution, @Default(DeviceType.watch) DeviceType type})
-
Creates a new watch device
constfactory
Properties
-
copyWith
→ $DeviceCopyWith<
Device> -
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- name → String
-
For example 'iPhone 12' or 'Samsung S10'.
no setterinherited
- resolution → Resolution
-
Specifies the native resolution (of the device screen)
and the logical resolution (for rendering a preview on the device).
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- type → DeviceType
-
Categorizes the Device.
For instance mobile or tablet.
This is used to display an appropriate icon in the device bar.
no setterinherited
Methods
-
map<
TResult extends Object?> (TResult $default(_Device value), {required TResult watch(_DeviceWatch value), required TResult mobile(_DeviceMobile value), required TResult tablet(_DeviceTablet value), required TResult desktop(_DeviceDesktop value), required TResult special(_DeviceSpecial value)}) → TResult -
inherited
-
mapOrNull<
TResult extends Object?> (TResult $default(_Device value)?, {TResult watch(_DeviceWatch value)?, TResult mobile(_DeviceMobile value)?, TResult tablet(_DeviceTablet value)?, TResult desktop(_DeviceDesktop value)?, TResult special(_DeviceSpecial value)?}) → TResult? -
inherited
-
maybeMap<
TResult extends Object?> (TResult $default(_Device value)?, {TResult watch(_DeviceWatch value)?, TResult mobile(_DeviceMobile value)?, TResult tablet(_DeviceTablet value)?, TResult desktop(_DeviceDesktop value)?, TResult special(_DeviceSpecial value)?, required TResult orElse()}) → TResult -
inherited
-
maybeWhen<
TResult extends Object?> (TResult $default(String name, Resolution resolution, DeviceType type)?, {TResult watch(String name, Resolution resolution, DeviceType type)?, TResult mobile(String name, Resolution resolution, DeviceType type)?, TResult tablet(String name, Resolution resolution, DeviceType type)?, TResult desktop(String name, Resolution resolution, DeviceType type)?, TResult special(String name, Resolution resolution, DeviceType type)?, required TResult orElse()}) → TResult -
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
when<
TResult extends Object?> (TResult $default(String name, Resolution resolution, DeviceType type), {required TResult watch(String name, Resolution resolution, DeviceType type), required TResult mobile(String name, Resolution resolution, DeviceType type), required TResult tablet(String name, Resolution resolution, DeviceType type), required TResult desktop(String name, Resolution resolution, DeviceType type), required TResult special(String name, Resolution resolution, DeviceType type)}) → TResult -
inherited
-
whenOrNull<
TResult extends Object?> (TResult $default(String name, Resolution resolution, DeviceType type)?, {TResult watch(String name, Resolution resolution, DeviceType type)?, TResult mobile(String name, Resolution resolution, DeviceType type)?, TResult tablet(String name, Resolution resolution, DeviceType type)?, TResult desktop(String name, Resolution resolution, DeviceType type)?, TResult special(String name, Resolution resolution, DeviceType type)?}) → TResult? -
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited