How can I let a plugin depend on another module?
Yes, this is possible.
You may declare a dependency on a module by using the &quot;provider&quot; key in the annotation. For your example, this would look like:
/**
 * @FieldWidget(
 *   id = &quot;my_daterange&quot;,
 *   label = @Translation(&quot;Date and time range + All day&quot;),
 *   field_types = {
 *     &quot;daterange&quot;
 *   },
 *   provider = &quot;date_all_day&quot;
 * )
 */
class MyPlugin {...}

Note that you can only list ONE provider, but of course that provider module can depend on other modules ...
This is a feature added to the DefaultPluginManager in order to allow plugins to declare a dependency on one (and only one) module. This only works for plugins that use a plugin manager derived from DefaultPluginManager.
Specifically, @FieldWidget plugins are managed by the WidgetPluginManager, which DOES subclass DefaultPluginManager, so this will work. (Most, if not all, core plugin managers subclass DefaultPluginManager.)