blocStateTemplate function

String blocStateTemplate(
  1. String feature
)

Implementation

String blocStateTemplate(String feature) =>
    '''
part of '${feature}_bloc.dart';

final class ${_cap(feature)}State extends Equatable {
  const ${_cap(feature)}State({
    this.fetchStatus = AppStatus.initial,
    this.error,
    this.${feature}s,
    this.nextPage = 0,
    this.offSet = 0,
    this.totalPage = 0,
  });

  final AppStatus fetchStatus;
  final Failure? error;
  final List<${_cap(feature)}Data>? ${feature}s;
  final int nextPage;
  final int offSet;
  final int totalPage;

  ${_cap(feature)}State copyWith({
    AppStatus? fetchStatus,
    Failure? error,
    List<${_cap(feature)}Data>? ${feature}s,
    int? nextPage,
    int? offSet,
    int? totalPage,
  }) {
    return ${_cap(feature)}State(
      fetchStatus: fetchStatus ?? this.fetchStatus,
      error: error ?? this.error,
      ${feature}s: ${feature}s ?? this.${feature}s,
      nextPage: nextPage ?? this.nextPage,
      offSet: offSet ?? this.offSet,
      totalPage: totalPage ?? this.totalPage,
    );
  }

  @override
  List<Object?> get props => <Object?>[fetchStatus, error, ${feature}s, nextPage, offSet, totalPage];
}
''';