getCloudDataVariableAccessorsForType function
Defines accessors for a cloud data variable based on the type of date it holds.
Implementation
List<Accessor> getCloudDataVariableAccessorsForType(VariableType dataType) => [
Accessor(
name: 'url',
type: VariableType.text,
getValue: (value) => value.toMap()?['url'],
),
Accessor(
name: 'status',
type: VariableType.text,
getValue: (value) => value.toMap()?['status']?.toString(),
),
Accessor(
name: 'isIdle',
type: VariableType.boolean,
getValue: (value) => value.toMap()?['isIdle']?.toBool(),
),
Accessor(
name: 'isLoading',
type: VariableType.boolean,
getValue: (value) => value.toMap()?['isLoading']?.toBool(),
),
Accessor(
name: 'isError',
type: VariableType.boolean,
getValue: (value) => value.toMap()?['isError']?.toBool(),
),
Accessor(
name: 'isSuccess',
type: VariableType.boolean,
getValue: (value) => value.toMap()?['isSuccess']?.toBool(),
),
Accessor(
name: 'hasData',
type: VariableType.boolean,
getValue: (value) => value.toMap()?['hasData']?.toBool(),
),
Accessor(
name: 'data',
type: dataType,
getValue: (value) => value.toMap()?['data'],
),
Accessor(
name: 'error',
type: dataType,
getValue: (value) => value.toMap()?['error'],
),
];