# ListedItemFormBloc constructor Null safety

ListedItemFormBloc(

1. String? appId

)

## Implementation

    ListedItemFormBloc(
      this.appId,
    ) : super(ListedItemFormUninitialized()) {
      on<InitialiseNewListedItemFormEvent>((event, emit) {
        ListedItemFormLoaded loaded = ListedItemFormLoaded(
            value: ListedItemModel(
          documentID: "IDENTIFIED",
          description: "",
        ));
        emit(loaded);
      });

      on<InitialiseListedItemFormEvent>((event, emit) async {
        ListedItemFormLoaded loaded = ListedItemFormLoaded(value: event.value);
        emit(loaded);
      });
      on<InitialiseListedItemFormNoLoadEvent>((event, emit) async {
        ListedItemFormLoaded loaded = ListedItemFormLoaded(value: event.value);
        emit(loaded);
      });
      ListedItemModel? newValue;
      on<ChangedListedItemDescription>((event, emit) async {
        if (state is ListedItemFormInitialized) {
          final currentState = state as ListedItemFormInitialized;
          newValue = currentState.value!.copyWith(description: event.value);
          emit(SubmittableListedItemForm(value: newValue));
        }
      });
      on<ChangedListedItemAction>((event, emit) async {
        if (state is ListedItemFormInitialized) {
          final currentState = state as ListedItemFormInitialized;
          newValue = currentState.value!.copyWith(action: event.value);
          emit(SubmittableListedItemForm(value: newValue));
        }
      });
      on<ChangedListedItemImage>((event, emit) async {
        if (state is ListedItemFormInitialized) {
          final currentState = state as ListedItemFormInitialized;
          if (event.value != null) {
            newValue = currentState.value!.copyWith(
                image: await platformMediumRepository(appId: appId)!
                    .get(event.value));
          }
          emit(SubmittableListedItemForm(value: newValue));
        }
      });
      on<ChangedListedItemPosSize>((event, emit) async {
        if (state is ListedItemFormInitialized) {
          final currentState = state as ListedItemFormInitialized;
          newValue = currentState.value!.copyWith(posSize: event.value);
          emit(SubmittableListedItemForm(value: newValue));
        }
      });
    }