printer form, bluetooth

This commit is contained in:
efrilm
2025-11-04 14:58:51 +07:00
parent dca0f546f9
commit a87b62ca9f
35 changed files with 2586 additions and 13 deletions
@@ -0,0 +1,47 @@
import 'package:bloc/bloc.dart';
import 'package:dartz/dartz.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:injectable/injectable.dart';
import 'package:print_bluetooth_thermal/print_bluetooth_thermal.dart';
import '../../../../domain/printer/printer.dart';
part 'bluetooth_loader_event.dart';
part 'bluetooth_loader_state.dart';
part 'bluetooth_loader_bloc.freezed.dart';
@injectable
class BluetoothLoaderBloc
extends Bloc<BluetoothLoaderEvent, BluetoothLoaderState> {
final IPrinterRepository _printerRepository;
BluetoothLoaderBloc(this._printerRepository)
: super(BluetoothLoaderState.initial()) {
on<BluetoothLoaderEvent>(_onBluetoothLoaderEvent);
}
Future<void> _onBluetoothLoaderEvent(
BluetoothLoaderEvent event,
Emitter<BluetoothLoaderState> emit,
) {
return event.map(
fetched: (e) async {
emit(state.copyWith(isFetching: true, failureOption: none()));
final result = await _printerRepository.getPairedBluetoothDevices();
result.fold(
(failure) => emit(
state.copyWith(failureOption: optionOf(failure), isFetching: false),
),
(devices) => emit(
state.copyWith(
bluetoothDevices: devices,
failureOption: none(),
isFetching: false,
),
),
);
},
);
}
}
@@ -0,0 +1,379 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'bluetooth_loader_bloc.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
);
/// @nodoc
mixin _$BluetoothLoaderEvent {
@optionalTypeArgs
TResult when<TResult extends Object?>({
required TResult Function() fetched,
}) => throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult? Function()? fetched,
}) => throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function()? fetched,
required TResult orElse(),
}) => throw _privateConstructorUsedError;
@optionalTypeArgs
TResult map<TResult extends Object?>({
required TResult Function(_Fetched value) fetched,
}) => throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult? Function(_Fetched value)? fetched,
}) => throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(_Fetched value)? fetched,
required TResult orElse(),
}) => throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $BluetoothLoaderEventCopyWith<$Res> {
factory $BluetoothLoaderEventCopyWith(
BluetoothLoaderEvent value,
$Res Function(BluetoothLoaderEvent) then,
) = _$BluetoothLoaderEventCopyWithImpl<$Res, BluetoothLoaderEvent>;
}
/// @nodoc
class _$BluetoothLoaderEventCopyWithImpl<
$Res,
$Val extends BluetoothLoaderEvent
>
implements $BluetoothLoaderEventCopyWith<$Res> {
_$BluetoothLoaderEventCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of BluetoothLoaderEvent
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
abstract class _$$FetchedImplCopyWith<$Res> {
factory _$$FetchedImplCopyWith(
_$FetchedImpl value,
$Res Function(_$FetchedImpl) then,
) = __$$FetchedImplCopyWithImpl<$Res>;
}
/// @nodoc
class __$$FetchedImplCopyWithImpl<$Res>
extends _$BluetoothLoaderEventCopyWithImpl<$Res, _$FetchedImpl>
implements _$$FetchedImplCopyWith<$Res> {
__$$FetchedImplCopyWithImpl(
_$FetchedImpl _value,
$Res Function(_$FetchedImpl) _then,
) : super(_value, _then);
/// Create a copy of BluetoothLoaderEvent
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
class _$FetchedImpl implements _Fetched {
const _$FetchedImpl();
@override
String toString() {
return 'BluetoothLoaderEvent.fetched()';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType && other is _$FetchedImpl);
}
@override
int get hashCode => runtimeType.hashCode;
@override
@optionalTypeArgs
TResult when<TResult extends Object?>({required TResult Function() fetched}) {
return fetched();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({TResult? Function()? fetched}) {
return fetched?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function()? fetched,
required TResult orElse(),
}) {
if (fetched != null) {
return fetched();
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>({
required TResult Function(_Fetched value) fetched,
}) {
return fetched(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult? Function(_Fetched value)? fetched,
}) {
return fetched?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(_Fetched value)? fetched,
required TResult orElse(),
}) {
if (fetched != null) {
return fetched(this);
}
return orElse();
}
}
abstract class _Fetched implements BluetoothLoaderEvent {
const factory _Fetched() = _$FetchedImpl;
}
/// @nodoc
mixin _$BluetoothLoaderState {
List<BluetoothInfo> get bluetoothDevices =>
throw _privateConstructorUsedError;
Option<PrinterFailure> get failureOption =>
throw _privateConstructorUsedError;
bool get isFetching => throw _privateConstructorUsedError;
/// Create a copy of BluetoothLoaderState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$BluetoothLoaderStateCopyWith<BluetoothLoaderState> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $BluetoothLoaderStateCopyWith<$Res> {
factory $BluetoothLoaderStateCopyWith(
BluetoothLoaderState value,
$Res Function(BluetoothLoaderState) then,
) = _$BluetoothLoaderStateCopyWithImpl<$Res, BluetoothLoaderState>;
@useResult
$Res call({
List<BluetoothInfo> bluetoothDevices,
Option<PrinterFailure> failureOption,
bool isFetching,
});
}
/// @nodoc
class _$BluetoothLoaderStateCopyWithImpl<
$Res,
$Val extends BluetoothLoaderState
>
implements $BluetoothLoaderStateCopyWith<$Res> {
_$BluetoothLoaderStateCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of BluetoothLoaderState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? bluetoothDevices = null,
Object? failureOption = null,
Object? isFetching = null,
}) {
return _then(
_value.copyWith(
bluetoothDevices: null == bluetoothDevices
? _value.bluetoothDevices
: bluetoothDevices // ignore: cast_nullable_to_non_nullable
as List<BluetoothInfo>,
failureOption: null == failureOption
? _value.failureOption
: failureOption // ignore: cast_nullable_to_non_nullable
as Option<PrinterFailure>,
isFetching: null == isFetching
? _value.isFetching
: isFetching // ignore: cast_nullable_to_non_nullable
as bool,
)
as $Val,
);
}
}
/// @nodoc
abstract class _$$BluetoothLoaderStateImplCopyWith<$Res>
implements $BluetoothLoaderStateCopyWith<$Res> {
factory _$$BluetoothLoaderStateImplCopyWith(
_$BluetoothLoaderStateImpl value,
$Res Function(_$BluetoothLoaderStateImpl) then,
) = __$$BluetoothLoaderStateImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({
List<BluetoothInfo> bluetoothDevices,
Option<PrinterFailure> failureOption,
bool isFetching,
});
}
/// @nodoc
class __$$BluetoothLoaderStateImplCopyWithImpl<$Res>
extends _$BluetoothLoaderStateCopyWithImpl<$Res, _$BluetoothLoaderStateImpl>
implements _$$BluetoothLoaderStateImplCopyWith<$Res> {
__$$BluetoothLoaderStateImplCopyWithImpl(
_$BluetoothLoaderStateImpl _value,
$Res Function(_$BluetoothLoaderStateImpl) _then,
) : super(_value, _then);
/// Create a copy of BluetoothLoaderState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? bluetoothDevices = null,
Object? failureOption = null,
Object? isFetching = null,
}) {
return _then(
_$BluetoothLoaderStateImpl(
bluetoothDevices: null == bluetoothDevices
? _value._bluetoothDevices
: bluetoothDevices // ignore: cast_nullable_to_non_nullable
as List<BluetoothInfo>,
failureOption: null == failureOption
? _value.failureOption
: failureOption // ignore: cast_nullable_to_non_nullable
as Option<PrinterFailure>,
isFetching: null == isFetching
? _value.isFetching
: isFetching // ignore: cast_nullable_to_non_nullable
as bool,
),
);
}
}
/// @nodoc
class _$BluetoothLoaderStateImpl implements _BluetoothLoaderState {
_$BluetoothLoaderStateImpl({
required final List<BluetoothInfo> bluetoothDevices,
required this.failureOption,
this.isFetching = false,
}) : _bluetoothDevices = bluetoothDevices;
final List<BluetoothInfo> _bluetoothDevices;
@override
List<BluetoothInfo> get bluetoothDevices {
if (_bluetoothDevices is EqualUnmodifiableListView)
return _bluetoothDevices;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_bluetoothDevices);
}
@override
final Option<PrinterFailure> failureOption;
@override
@JsonKey()
final bool isFetching;
@override
String toString() {
return 'BluetoothLoaderState(bluetoothDevices: $bluetoothDevices, failureOption: $failureOption, isFetching: $isFetching)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$BluetoothLoaderStateImpl &&
const DeepCollectionEquality().equals(
other._bluetoothDevices,
_bluetoothDevices,
) &&
(identical(other.failureOption, failureOption) ||
other.failureOption == failureOption) &&
(identical(other.isFetching, isFetching) ||
other.isFetching == isFetching));
}
@override
int get hashCode => Object.hash(
runtimeType,
const DeepCollectionEquality().hash(_bluetoothDevices),
failureOption,
isFetching,
);
/// Create a copy of BluetoothLoaderState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$BluetoothLoaderStateImplCopyWith<_$BluetoothLoaderStateImpl>
get copyWith =>
__$$BluetoothLoaderStateImplCopyWithImpl<_$BluetoothLoaderStateImpl>(
this,
_$identity,
);
}
abstract class _BluetoothLoaderState implements BluetoothLoaderState {
factory _BluetoothLoaderState({
required final List<BluetoothInfo> bluetoothDevices,
required final Option<PrinterFailure> failureOption,
final bool isFetching,
}) = _$BluetoothLoaderStateImpl;
@override
List<BluetoothInfo> get bluetoothDevices;
@override
Option<PrinterFailure> get failureOption;
@override
bool get isFetching;
/// Create a copy of BluetoothLoaderState
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$BluetoothLoaderStateImplCopyWith<_$BluetoothLoaderStateImpl>
get copyWith => throw _privateConstructorUsedError;
}
@@ -0,0 +1,6 @@
part of 'bluetooth_loader_bloc.dart';
@freezed
class BluetoothLoaderEvent with _$BluetoothLoaderEvent {
const factory BluetoothLoaderEvent.fetched() = _Fetched;
}
@@ -0,0 +1,13 @@
part of 'bluetooth_loader_bloc.dart';
@freezed
class BluetoothLoaderState with _$BluetoothLoaderState {
factory BluetoothLoaderState({
required List<BluetoothInfo> bluetoothDevices,
required Option<PrinterFailure> failureOption,
@Default(false) bool isFetching,
}) = _BluetoothLoaderState;
factory BluetoothLoaderState.initial() =>
BluetoothLoaderState(bluetoothDevices: [], failureOption: none());
}
+22
View File
@@ -0,0 +1,22 @@
import 'package:bloc/bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:injectable/injectable.dart';
part 'printer_event.dart';
part 'printer_state.dart';
part 'printer_bloc.freezed.dart';
@injectable
class PrinterBloc extends Bloc<PrinterEvent, PrinterState> {
PrinterBloc() : super(PrinterState.initial()) {
on<PrinterEvent>(_onPrinterEvent);
}
Future<void> _onPrinterEvent(PrinterEvent event, Emitter<PrinterState> emit) {
return event.map(
indexChanged: (e) async {
emit(state.copyWith(index: e.index));
},
);
}
}
@@ -0,0 +1,363 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'printer_bloc.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
);
/// @nodoc
mixin _$PrinterEvent {
int get index => throw _privateConstructorUsedError;
@optionalTypeArgs
TResult when<TResult extends Object?>({
required TResult Function(int index) indexChanged,
}) => throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult? Function(int index)? indexChanged,
}) => throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function(int index)? indexChanged,
required TResult orElse(),
}) => throw _privateConstructorUsedError;
@optionalTypeArgs
TResult map<TResult extends Object?>({
required TResult Function(_IndexChanged value) indexChanged,
}) => throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult? Function(_IndexChanged value)? indexChanged,
}) => throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(_IndexChanged value)? indexChanged,
required TResult orElse(),
}) => throw _privateConstructorUsedError;
/// Create a copy of PrinterEvent
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$PrinterEventCopyWith<PrinterEvent> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $PrinterEventCopyWith<$Res> {
factory $PrinterEventCopyWith(
PrinterEvent value,
$Res Function(PrinterEvent) then,
) = _$PrinterEventCopyWithImpl<$Res, PrinterEvent>;
@useResult
$Res call({int index});
}
/// @nodoc
class _$PrinterEventCopyWithImpl<$Res, $Val extends PrinterEvent>
implements $PrinterEventCopyWith<$Res> {
_$PrinterEventCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of PrinterEvent
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({Object? index = null}) {
return _then(
_value.copyWith(
index: null == index
? _value.index
: index // ignore: cast_nullable_to_non_nullable
as int,
)
as $Val,
);
}
}
/// @nodoc
abstract class _$$IndexChangedImplCopyWith<$Res>
implements $PrinterEventCopyWith<$Res> {
factory _$$IndexChangedImplCopyWith(
_$IndexChangedImpl value,
$Res Function(_$IndexChangedImpl) then,
) = __$$IndexChangedImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({int index});
}
/// @nodoc
class __$$IndexChangedImplCopyWithImpl<$Res>
extends _$PrinterEventCopyWithImpl<$Res, _$IndexChangedImpl>
implements _$$IndexChangedImplCopyWith<$Res> {
__$$IndexChangedImplCopyWithImpl(
_$IndexChangedImpl _value,
$Res Function(_$IndexChangedImpl) _then,
) : super(_value, _then);
/// Create a copy of PrinterEvent
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({Object? index = null}) {
return _then(
_$IndexChangedImpl(
null == index
? _value.index
: index // ignore: cast_nullable_to_non_nullable
as int,
),
);
}
}
/// @nodoc
class _$IndexChangedImpl implements _IndexChanged {
const _$IndexChangedImpl(this.index);
@override
final int index;
@override
String toString() {
return 'PrinterEvent.indexChanged(index: $index)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$IndexChangedImpl &&
(identical(other.index, index) || other.index == index));
}
@override
int get hashCode => Object.hash(runtimeType, index);
/// Create a copy of PrinterEvent
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$IndexChangedImplCopyWith<_$IndexChangedImpl> get copyWith =>
__$$IndexChangedImplCopyWithImpl<_$IndexChangedImpl>(this, _$identity);
@override
@optionalTypeArgs
TResult when<TResult extends Object?>({
required TResult Function(int index) indexChanged,
}) {
return indexChanged(index);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult? Function(int index)? indexChanged,
}) {
return indexChanged?.call(index);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function(int index)? indexChanged,
required TResult orElse(),
}) {
if (indexChanged != null) {
return indexChanged(index);
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>({
required TResult Function(_IndexChanged value) indexChanged,
}) {
return indexChanged(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult? Function(_IndexChanged value)? indexChanged,
}) {
return indexChanged?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(_IndexChanged value)? indexChanged,
required TResult orElse(),
}) {
if (indexChanged != null) {
return indexChanged(this);
}
return orElse();
}
}
abstract class _IndexChanged implements PrinterEvent {
const factory _IndexChanged(final int index) = _$IndexChangedImpl;
@override
int get index;
/// Create a copy of PrinterEvent
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$IndexChangedImplCopyWith<_$IndexChangedImpl> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
mixin _$PrinterState {
int get index => throw _privateConstructorUsedError;
/// Create a copy of PrinterState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$PrinterStateCopyWith<PrinterState> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $PrinterStateCopyWith<$Res> {
factory $PrinterStateCopyWith(
PrinterState value,
$Res Function(PrinterState) then,
) = _$PrinterStateCopyWithImpl<$Res, PrinterState>;
@useResult
$Res call({int index});
}
/// @nodoc
class _$PrinterStateCopyWithImpl<$Res, $Val extends PrinterState>
implements $PrinterStateCopyWith<$Res> {
_$PrinterStateCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of PrinterState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({Object? index = null}) {
return _then(
_value.copyWith(
index: null == index
? _value.index
: index // ignore: cast_nullable_to_non_nullable
as int,
)
as $Val,
);
}
}
/// @nodoc
abstract class _$$PrinterStateImplCopyWith<$Res>
implements $PrinterStateCopyWith<$Res> {
factory _$$PrinterStateImplCopyWith(
_$PrinterStateImpl value,
$Res Function(_$PrinterStateImpl) then,
) = __$$PrinterStateImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({int index});
}
/// @nodoc
class __$$PrinterStateImplCopyWithImpl<$Res>
extends _$PrinterStateCopyWithImpl<$Res, _$PrinterStateImpl>
implements _$$PrinterStateImplCopyWith<$Res> {
__$$PrinterStateImplCopyWithImpl(
_$PrinterStateImpl _value,
$Res Function(_$PrinterStateImpl) _then,
) : super(_value, _then);
/// Create a copy of PrinterState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({Object? index = null}) {
return _then(
_$PrinterStateImpl(
index: null == index
? _value.index
: index // ignore: cast_nullable_to_non_nullable
as int,
),
);
}
}
/// @nodoc
class _$PrinterStateImpl implements _PrinterState {
_$PrinterStateImpl({this.index = 0});
@override
@JsonKey()
final int index;
@override
String toString() {
return 'PrinterState(index: $index)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$PrinterStateImpl &&
(identical(other.index, index) || other.index == index));
}
@override
int get hashCode => Object.hash(runtimeType, index);
/// Create a copy of PrinterState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$PrinterStateImplCopyWith<_$PrinterStateImpl> get copyWith =>
__$$PrinterStateImplCopyWithImpl<_$PrinterStateImpl>(this, _$identity);
}
abstract class _PrinterState implements PrinterState {
factory _PrinterState({final int index}) = _$PrinterStateImpl;
@override
int get index;
/// Create a copy of PrinterState
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$PrinterStateImplCopyWith<_$PrinterStateImpl> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -0,0 +1,6 @@
part of 'printer_bloc.dart';
@freezed
class PrinterEvent with _$PrinterEvent {
const factory PrinterEvent.indexChanged(int index) = _IndexChanged;
}
@@ -0,0 +1,7 @@
part of 'printer_bloc.dart';
@freezed
class PrinterState with _$PrinterState {
factory PrinterState({@Default(0) int index}) = _PrinterState;
factory PrinterState.initial() => PrinterState();
}