ConnectivityListener class

@Deprecated Will be removed in a future release. Please use a connectivity checker of your own choice in your application code

Listener class that returns a Stream

ConnectivityListener({hostname:'google.com', port:80}).subscribe().listen((isConnected) {
  if (isConnected) {
    print('connection available');
   } else {
    print('connection lost');
  }
});
Annotations
  • @Deprecated('Will be removed in a future release.' ' Please use a connectivity checker of your own choice' ' in your application code')

Constructors

ConnectivityListener({String? hostname, int? port, Duration checkInterval = const Duration(seconds: 10)})

Properties

checkInterval Duration
latefinal
hashCode int
The hash code for this object.
no setterinherited
hostname String?
latefinal
port int?
latefinal
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
subscribe() Stream<bool>
Listen to InternetConnectionChecker.onStatusChange and returns Stream
toString() String
A string representation of this object.
inherited
unSubscribe() → void
Cancels the active subscription to InternetConnectionChecker

Operators

operator ==(Object other) bool
The equality operator.
inherited