mirror of
				https://github.com/immich-app/immich.git
				synced 2025-10-30 18:22:37 -04:00 
			
		
		
		
	* enable border radius, switch exp, const constructor * regenerate provider * more formatting --------- Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
		
			
				
	
	
		
			35 lines
		
	
	
		
			919 B
		
	
	
	
		
			Dart
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
		
			919 B
		
	
	
	
		
			Dart
		
	
	
	
	
	
| import 'dart:io';
 | |
| 
 | |
| import 'package:hooks_riverpod/hooks_riverpod.dart';
 | |
| import 'package:network_info_plus/network_info_plus.dart';
 | |
| 
 | |
| final networkRepositoryProvider = Provider((_) {
 | |
|   final networkInfo = NetworkInfo();
 | |
| 
 | |
|   return NetworkRepository(networkInfo);
 | |
| });
 | |
| 
 | |
| class NetworkRepository {
 | |
|   final NetworkInfo _networkInfo;
 | |
| 
 | |
|   const NetworkRepository(this._networkInfo);
 | |
| 
 | |
|   Future<String?> getWifiName() {
 | |
|     if (Platform.isAndroid) {
 | |
|       // remove quote around the return value on Android
 | |
|       // https://github.com/fluttercommunity/plus_plugins/tree/main/packages/network_info_plus/network_info_plus#android
 | |
|       return _networkInfo.getWifiName().then((value) {
 | |
|         if (value != null) {
 | |
|           return value.replaceAll(RegExp(r'"'), '');
 | |
|         }
 | |
|         return value;
 | |
|       });
 | |
|     }
 | |
|     return _networkInfo.getWifiName();
 | |
|   }
 | |
| 
 | |
|   Future<String?> getWifiIp() {
 | |
|     return _networkInfo.getWifiIP();
 | |
|   }
 | |
| }
 |