I have a form with multiple fields. How can I get the value of field B from within the formElement method of my widget class for field A?
If you are writing a widget for a field that's not a good practice to make it dependent to other fields, that does not make sense at all, a widget should be independent, form_state is passed and can be used in form element definition of a field widget but in most cases it is not used to check the data of other fields, in most cases form_state is used in ajax callbacks when you need something like add more button or etc.
So how you should have change your widget dependent on other fields? the answer is you should use form alter solution, in this solution you can change different things about a widget, maybe the widget type at all, like if a select widget is provided with less than 2 options you can hide it as there would be no selection.