# DocumentItemFormBloc constructor Null safety

DocumentItemFormBloc(

1. String? appId

)

## Implementation

    DocumentItemFormBloc(
      this.appId,
    ) : super(DocumentItemFormUninitialized()) {
      on<InitialiseNewDocumentItemFormEvent>((event, emit) {
        DocumentItemFormLoaded loaded = DocumentItemFormLoaded(
            value: DocumentItemModel(
          documentID: "IDENTIFIER",
          reference: "REFERENCE",
        ));
        emit(loaded);
      });

      on<InitialiseDocumentItemFormEvent>((event, emit) async {
        DocumentItemFormLoaded loaded =
            DocumentItemFormLoaded(value: event.value);
        emit(loaded);
      });
      on<InitialiseDocumentItemFormNoLoadEvent>((event, emit) async {
        DocumentItemFormLoaded loaded =
            DocumentItemFormLoaded(value: event.value);
        emit(loaded);
      });
      DocumentItemModel? newValue;
      on<ChangedDocumentItemReference>((event, emit) async {
        if (state is DocumentItemFormInitialized) {
          final currentState = state as DocumentItemFormInitialized;
          newValue = currentState.value!.copyWith(reference: event.value);
          emit(SubmittableDocumentItemForm(value: newValue));
        }
      });
      on<ChangedDocumentItemImage>((event, emit) async {
        if (state is DocumentItemFormInitialized) {
          final currentState = state as DocumentItemFormInitialized;
          if (event.value != null) {
            newValue = currentState.value!.copyWith(
                image: await platformMediumRepository(appId: appId)!
                    .get(event.value));
          }
          emit(SubmittableDocumentItemForm(value: newValue));
        }
      });
    }