Plugin
connectivity_plus
Use case
A convenient getter that makes the API design more self-explanatory and slightly easier to read:
final result = await checkConnectivity();
print(result.hasConnectivity);
In many cases, only the general connectivity state is required (connected vs disconnected), independent of the underlying transport (e.g., Wifi, Ethernet).
A very minor feature that is commonly used in published packages (e.g., serverpod_flutter).
Proposal
// connectivity_plus_platform_interface/lib/src/enums.dart
extension ConnectivityResultListX on List<ConnectivityResult> {
bool get hasConnectivity =>
!(length == 1 && first == ConnectivityResult.none);
}
This implementation respects the current doc comment of connectivity_plus:
/// The returned list is never empty. In case of no connectivity, the list contains
/// a single element of [ConnectivityResult.none]. Note also that this is the only
/// case where [ConnectivityResult.none] is present.
Plugin
connectivity_plus
Use case
A convenient getter that makes the API design more self-explanatory and slightly easier to read:
In many cases, only the general connectivity state is required (connected vs disconnected), independent of the underlying transport (e.g., Wifi, Ethernet).
A very minor feature that is commonly used in published packages (e.g., serverpod_flutter).
Proposal
This implementation respects the current doc comment of
connectivity_plus: