CyberConnectivityService class
Constructors
- CyberConnectivityService()
-
factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
-
onConnectivityChanged
→ Stream<
List< ConnectivityResult> > -
✅ Stream để lắng nghe thay đổi kết nối (version 7.0.0)
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
checkConnectivity(
) → Future< List< ConnectivityResult> > - ✅ Kiểm tra có kết nối internet không
-
checkInternetSpeed(
{String testUrl = 'https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png', Duration timeout = const Duration(seconds: 5)}) → Future< double?> - Kiểm tra tốc độ internet (trả về KB/s) Returns null nếu không thể test được
-
getConnectionType(
List< ConnectivityResult> results) → String - ✅ Lấy thông tin loại kết nối hiện tại
-
hasActiveConnection(
List< ConnectivityResult> results) → bool - ✅ Kiểm tra có kết nối active không
-
hasInternetConnection(
{Duration timeout = const Duration(seconds: 3)}) → Future< bool> - Kiểm tra internet có hoạt động thực sự không (ping Google)
-
isUsingVPN(
) → Future< bool> - Kiểm tra có đang sử dụng VPN không
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
performFastCheck(
{bool checkSpeed = false, double minimumSpeedKBps = 10.0}) → Future< InternetCheckResult> - ⚡ OPTIMIZED: Fast check - chỉ check cơ bản (connectivity + ping) Dùng cho API calls thường xuyên (với cache) Thời gian: ~100-500ms thay vì 10s+
-
performFullCheck(
{double minimumSpeedKBps = 100.0, bool checkSpeed = true}) → Future< InternetCheckResult> - Kiểm tra toàn diện trước khi call API (CHẬM - dùng cho lần đầu) ⚠️ CHỈ dùng khi cần kiểm tra đầy đủ (login, first load, manual refresh)
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited