├── example ├── ios │ ├── Runner │ │ ├── Runner-Bridging-Header.h │ │ ├── Assets.xcassets │ │ │ ├── LaunchImage.imageset │ │ │ │ ├── LaunchImage.png │ │ │ │ ├── LaunchImage@2x.png │ │ │ │ ├── LaunchImage@3x.png │ │ │ │ ├── README.md │ │ │ │ └── Contents.json │ │ │ └── AppIcon.appiconset │ │ │ │ ├── Icon-App-20x20@1x.png │ │ │ │ ├── Icon-App-20x20@2x.png │ │ │ │ ├── Icon-App-20x20@3x.png │ │ │ │ ├── Icon-App-29x29@1x.png │ │ │ │ ├── Icon-App-29x29@2x.png │ │ │ │ ├── Icon-App-29x29@3x.png │ │ │ │ ├── Icon-App-40x40@1x.png │ │ │ │ ├── Icon-App-40x40@2x.png │ │ │ │ ├── Icon-App-40x40@3x.png │ │ │ │ ├── Icon-App-60x60@2x.png │ │ │ │ ├── Icon-App-60x60@3x.png │ │ │ │ ├── Icon-App-76x76@1x.png │ │ │ │ ├── Icon-App-76x76@2x.png │ │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ │ ├── Icon-App-83.5x83.5@2x.png │ │ │ │ └── Contents.json │ │ ├── AppDelegate.swift │ │ ├── Base.lproj │ │ │ ├── Main.storyboard │ │ │ └── LaunchScreen.storyboard │ │ └── Info.plist │ ├── Flutter │ │ ├── Debug.xcconfig │ │ ├── Release.xcconfig │ │ └── AppFrameworkInfo.plist │ ├── Runner.xcodeproj │ │ ├── project.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ ├── WorkspaceSettings.xcsettings │ │ │ │ └── IDEWorkspaceChecks.plist │ │ ├── xcshareddata │ │ │ └── xcschemes │ │ │ │ └── Runner.xcscheme │ │ └── project.pbxproj │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── WorkspaceSettings.xcsettings │ │ │ └── IDEWorkspaceChecks.plist │ ├── .gitignore │ ├── Podfile.lock │ └── Podfile ├── web │ ├── favicon.png │ ├── icons │ │ ├── Icon-192.png │ │ ├── Icon-512.png │ │ ├── Icon-maskable-192.png │ │ └── Icon-maskable-512.png │ ├── manifest.json │ └── index.html ├── android │ ├── gradle.properties │ ├── app │ │ ├── src │ │ │ ├── main │ │ │ │ ├── res │ │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── drawable │ │ │ │ │ │ └── launch_background.xml │ │ │ │ │ ├── drawable-v21 │ │ │ │ │ │ └── launch_background.xml │ │ │ │ │ ├── values │ │ │ │ │ │ └── styles.xml │ │ │ │ │ └── values-night │ │ │ │ │ │ └── styles.xml │ │ │ │ ├── kotlin │ │ │ │ │ └── com │ │ │ │ │ │ └── vanethos │ │ │ │ │ │ └── example │ │ │ │ │ │ └── example │ │ │ │ │ │ └── MainActivity.kt │ │ │ │ └── AndroidManifest.xml │ │ │ ├── debug │ │ │ │ └── AndroidManifest.xml │ │ │ └── profile │ │ │ │ └── AndroidManifest.xml │ │ └── build.gradle │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ ├── .gitignore │ ├── settings.gradle │ └── build.gradle ├── pubspec.yaml ├── README.md ├── .metadata ├── analysis_options.yaml ├── .gitignore ├── lib │ └── main.dart └── pubspec.lock ├── lib ├── connectivity_widget.dart └── src │ ├── event.dart │ ├── connectivity_widget.dart │ └── connectivity_utils.dart ├── .metadata ├── test ├── mocks.dart ├── connectivity_widget_test.dart └── connectivity_utils_test.dart ├── .github └── workflows │ └── build.yaml ├── pubspec.yaml ├── LICENSE ├── .gitignore ├── CHANGELOG.md └── README.md /example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /example/web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vanethos/flutter_connectivity_widget/HEAD/example/web/favicon.png -------------------------------------------------------------------------------- /example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /example/web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vanethos/flutter_connectivity_widget/HEAD/example/web/icons/Icon-192.png -------------------------------------------------------------------------------- /example/web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vanethos/flutter_connectivity_widget/HEAD/example/web/icons/Icon-512.png -------------------------------------------------------------------------------- /example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vanethos/flutter_connectivity_widget/HEAD/example/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /example/web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vanethos/flutter_connectivity_widget/HEAD/example/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /lib/connectivity_widget.dart: -------------------------------------------------------------------------------- 1 | library connectivity_widget; 2 | 3 | export 'src/connectivity_utils.dart'; 4 | export 'src/connectivity_widget.dart'; 5 | -------------------------------------------------------------------------------- /lib/src/event.dart: -------------------------------------------------------------------------------- 1 | /// Empty class to be used with [Subject] and [Future] 2 | /// 3 | /// This prevents us from using a [void] as return type 4 | class Event {} 5 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vanethos/flutter_connectivity_widget/HEAD/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vanethos/flutter_connectivity_widget/HEAD/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vanethos/flutter_connectivity_widget/HEAD/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vanethos/flutter_connectivity_widget/HEAD/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vanethos/flutter_connectivity_widget/HEAD/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vanethos/flutter_connectivity_widget/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vanethos/flutter_connectivity_widget/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vanethos/flutter_connectivity_widget/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vanethos/flutter_connectivity_widget/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vanethos/flutter_connectivity_widget/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vanethos/flutter_connectivity_widget/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vanethos/flutter_connectivity_widget/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vanethos/flutter_connectivity_widget/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vanethos/flutter_connectivity_widget/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vanethos/flutter_connectivity_widget/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vanethos/flutter_connectivity_widget/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vanethos/flutter_connectivity_widget/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vanethos/flutter_connectivity_widget/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vanethos/flutter_connectivity_widget/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vanethos/flutter_connectivity_widget/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vanethos/flutter_connectivity_widget/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vanethos/flutter_connectivity_widget/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vanethos/flutter_connectivity_widget/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /example/android/app/src/main/kotlin/com/vanethos/example/example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.vanethos.example.example 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip 6 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: bc7bc940836f1f834699625426795fd6f07c18ec 8 | channel: beta 9 | 10 | project_type: package 11 | -------------------------------------------------------------------------------- /example/android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app 11 | key.properties 12 | **/*.keystore 13 | **/*.jks 14 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: example 2 | description: A new Flutter project. 3 | publish_to: none 4 | 5 | version: 1.0.0+1 6 | 7 | environment: 8 | sdk: '>=2.17.0 <3.0.0' 9 | 10 | dependencies: 11 | flutter: 12 | sdk: flutter 13 | 14 | connectivity_widget: 15 | path: ../ 16 | 17 | dev_dependencies: 18 | flutter_test: 19 | sdk: flutter 20 | flutter_lints: 21 | 22 | flutter: 23 | uses-material-design: true 24 | -------------------------------------------------------------------------------- /example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /test/mocks.dart: -------------------------------------------------------------------------------- 1 | import 'package:connectivity_plus/connectivity_plus.dart'; 2 | import 'package:connectivity_widget/connectivity_widget.dart'; 3 | import 'package:mocktail/mocktail.dart'; 4 | import 'package:http/http.dart' as http; 5 | 6 | class MockConnectivity extends Mock implements Connectivity {} 7 | 8 | class MockHttpClient extends Mock implements http.Client {} 9 | 10 | class MockResponse extends Mock implements http.Response {} 11 | 12 | class MockConnectivityUtils extends Mock implements ConnectivityUtils {} 13 | -------------------------------------------------------------------------------- /example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties") 4 | def properties = new Properties() 5 | 6 | assert localPropertiesFile.exists() 7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } 8 | 9 | def flutterSdkPath = properties.getProperty("flutter.sdk") 10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" 12 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # example 2 | 3 | A new Flutter project. 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter application. 8 | 9 | A few resources to get you started if this is your first Flutter project: 10 | 11 | - [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) 13 | 14 | For help getting started with Flutter, view our 15 | [online documentation](https://flutter.dev/docs), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /.github/workflows/build.yaml: -------------------------------------------------------------------------------- 1 | name: Build 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | pull_request: 8 | 9 | jobs: 10 | connectivity-test: 11 | runs-on: ubuntu-latest 12 | 13 | steps: 14 | - uses: actions/checkout@v3 15 | 16 | - uses: subosito/flutter-action@v2 17 | 18 | - name: Install dependencies 19 | run: | 20 | flutter pub get 21 | 22 | - name: Check format 23 | run: dart format --set-exit-if-changed . 24 | 25 | - name: Analyze 26 | run: flutter analyze 27 | 28 | - name: Run tests 29 | run: | 30 | flutter test 31 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: connectivity_widget 2 | description: A widget that shows the user if the phone is connected to the internet or not 3 | version: 3.0.0 4 | homepage: https://github.com/Vanethos/flutter_connectivity_widget/ 5 | issue_tracker: https://github.com/Vanethos/flutter_connectivity_widget/issues 6 | 7 | environment: 8 | sdk: '>=2.17.0 <4.0.0' 9 | 10 | dependencies: 11 | flutter: 12 | sdk: flutter 13 | rxdart: ^0.27.7 14 | connectivity_plus: ^6.0.3 15 | stream_disposable: ^2.0.0 16 | http: ^1.2.1 17 | retry: ^3.1.2 18 | 19 | dev_dependencies: 20 | flutter_test: 21 | sdk: flutter 22 | mocktail: ^1.0.3 23 | 24 | flutter: 25 | -------------------------------------------------------------------------------- /example/ios/.gitignore: -------------------------------------------------------------------------------- 1 | **/dgph 2 | *.mode1v3 3 | *.mode2v3 4 | *.moved-aside 5 | *.pbxuser 6 | *.perspectivev3 7 | **/*sync/ 8 | .sconsign.dblite 9 | .tags* 10 | **/.vagrant/ 11 | **/DerivedData/ 12 | Icon? 13 | **/Pods/ 14 | **/.symlinks/ 15 | profile 16 | xcuserdata 17 | **/.generated/ 18 | Flutter/App.framework 19 | Flutter/Flutter.framework 20 | Flutter/Flutter.podspec 21 | Flutter/Generated.xcconfig 22 | Flutter/ephemeral/ 23 | Flutter/app.flx 24 | Flutter/app.zip 25 | Flutter/flutter_assets/ 26 | Flutter/flutter_export_environment.sh 27 | ServiceDefinitions.json 28 | Runner/GeneratedPluginRegistrant.* 29 | 30 | # Exceptions to above rules. 31 | !default.mode1v3 32 | !default.mode2v3 33 | !default.pbxuser 34 | !default.perspectivev3 35 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.6.10' 3 | repositories { 4 | google() 5 | mavenCentral() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:7.1.2' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | mavenCentral() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | tasks.register("clean", Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /example/ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - connectivity_plus (0.0.1): 3 | - Flutter 4 | - ReachabilitySwift 5 | - Flutter (1.0.0) 6 | - ReachabilitySwift (5.0.0) 7 | 8 | DEPENDENCIES: 9 | - connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`) 10 | - Flutter (from `Flutter`) 11 | 12 | SPEC REPOS: 13 | trunk: 14 | - ReachabilitySwift 15 | 16 | EXTERNAL SOURCES: 17 | connectivity_plus: 18 | :path: ".symlinks/plugins/connectivity_plus/ios" 19 | Flutter: 20 | :path: Flutter 21 | 22 | SPEC CHECKSUMS: 23 | connectivity_plus: bf0076dd84a130856aa636df1c71ccaff908fa1d 24 | Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 25 | ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825 26 | 27 | PODFILE CHECKSUM: c4c93c5f6502fe2754f48404d3594bf779584011 28 | 29 | COCOAPODS: 1.14.3 30 | -------------------------------------------------------------------------------- /example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 12.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled. 5 | 6 | version: 7 | revision: ffccd96b62ee8cec7740dab303538c5fc26ac543 8 | channel: stable 9 | 10 | project_type: app 11 | 12 | # Tracks metadata for the flutter migrate command 13 | migration: 14 | platforms: 15 | - platform: root 16 | create_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543 17 | base_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543 18 | - platform: web 19 | create_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543 20 | base_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543 21 | 22 | # User provided section 23 | 24 | # List of Local paths (relative to this file) that should be 25 | # ignored by the migrate tool. 26 | # 27 | # Files that are not part of the templates will be ignored by default. 28 | unmanaged_files: 29 | - 'lib/main.dart' 30 | - 'ios/Runner.xcodeproj/project.pbxproj' 31 | -------------------------------------------------------------------------------- /example/web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "example", 3 | "short_name": "example", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "background_color": "#0175C2", 7 | "theme_color": "#0175C2", 8 | "description": "A new Flutter project.", 9 | "orientation": "portrait-primary", 10 | "prefer_related_applications": false, 11 | "icons": [ 12 | { 13 | "src": "icons/Icon-192.png", 14 | "sizes": "192x192", 15 | "type": "image/png" 16 | }, 17 | { 18 | "src": "icons/Icon-512.png", 19 | "sizes": "512x512", 20 | "type": "image/png" 21 | }, 22 | { 23 | "src": "icons/Icon-maskable-192.png", 24 | "sizes": "192x192", 25 | "type": "image/png", 26 | "purpose": "maskable" 27 | }, 28 | { 29 | "src": "icons/Icon-maskable-512.png", 30 | "sizes": "512x512", 31 | "type": "image/png", 32 | "purpose": "maskable" 33 | } 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 2-Clause License 2 | 3 | Copyright (c) 2019, Gonçalo Palma 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | * Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 20 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 22 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 23 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 24 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /example/ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '12.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | project 'Runner', { 8 | 'Debug' => :debug, 9 | 'Profile' => :release, 10 | 'Release' => :release, 11 | } 12 | 13 | def flutter_root 14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) 15 | unless File.exist?(generated_xcode_build_settings_path) 16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" 17 | end 18 | 19 | File.foreach(generated_xcode_build_settings_path) do |line| 20 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 21 | return matches[1].strip if matches 22 | end 23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" 24 | end 25 | 26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 27 | 28 | flutter_ios_podfile_setup 29 | 30 | target 'Runner' do 31 | use_frameworks! 32 | use_modular_headers! 33 | 34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) 35 | end 36 | 37 | post_install do |installer| 38 | installer.pods_project.targets.each do |target| 39 | flutter_additional_ios_build_settings(target) 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /example/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # This file configures the analyzer, which statically analyzes Dart code to 2 | # check for errors, warnings, and lints. 3 | # 4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled 5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be 6 | # invoked from the command line by running `flutter analyze`. 7 | 8 | # The following line activates a set of recommended lints for Flutter apps, 9 | # packages, and plugins designed to encourage good coding practices. 10 | include: package:flutter_lints/flutter.yaml 11 | 12 | linter: 13 | # The lint rules applied to this project can be customized in the 14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml` 15 | # included above or to enable additional rules. A list of all available lints 16 | # and their documentation is published at 17 | # https://dart-lang.github.io/linter/lints/index.html. 18 | # 19 | # Instead of disabling a lint rule for the entire project in the 20 | # section below, it can also be suppressed for a single line of code 21 | # or a specific dart file by using the `// ignore: name_of_lint` and 22 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file 23 | # producing the lint. 24 | rules: 25 | # avoid_print: false # Uncomment to disable the `avoid_print` rule 26 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule 27 | 28 | # Additional information about this file can be found at 29 | # https://dart.dev/guides/language/analysis-options 30 | -------------------------------------------------------------------------------- /example/ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | .dart_tool/ 26 | .flutter-plugins 27 | .packages 28 | .pub-cache/ 29 | .pub/ 30 | /build/ 31 | 32 | # Android related 33 | **/android/**/gradle-wrapper.jar 34 | **/android/.gradle 35 | **/android/captures/ 36 | **/android/gradlew 37 | **/android/gradlew.bat 38 | **/android/local.properties 39 | **/android/**/GeneratedPluginRegistrant.java 40 | 41 | # iOS/XCode related 42 | **/ios/**/*.mode1v3 43 | **/ios/**/*.mode2v3 44 | **/ios/**/*.moved-aside 45 | **/ios/**/*.pbxuser 46 | **/ios/**/*.perspectivev3 47 | **/ios/**/*sync/ 48 | **/ios/**/.sconsign.dblite 49 | **/ios/**/.tags* 50 | **/ios/**/.vagrant/ 51 | **/ios/**/DerivedData/ 52 | **/ios/**/Icon? 53 | **/ios/**/Pods/ 54 | **/ios/**/.symlinks/ 55 | **/ios/**/profile 56 | **/ios/**/xcuserdata 57 | **/ios/.generated/ 58 | **/ios/Flutter/App.framework 59 | **/ios/Flutter/Flutter.framework 60 | **/ios/Flutter/Generated.xcconfig 61 | **/ios/Flutter/app.flx 62 | **/ios/Flutter/app.zip 63 | **/ios/Flutter/flutter_assets/ 64 | **/ios/Flutter/flutter_export_environment.sh 65 | **/ios/ServiceDefinitions.json 66 | **/ios/Runner/GeneratedPluginRegistrant.* 67 | 68 | # Exceptions to above rules. 69 | !**/ios/**/default.mode1v3 70 | !**/ios/**/default.mode2v3 71 | !**/ios/**/default.pbxuser 72 | !**/ios/**/default.perspectivev3 73 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 74 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 15 | 19 | 23 | 24 | 25 | 26 | 27 | 28 | 30 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | .dart_tool/ 26 | .flutter-plugins 27 | .packages 28 | .pub-cache/ 29 | .pub/ 30 | build/ 31 | .flutter-plugins-dependencies 32 | pubspec.lock 33 | 34 | # Android related 35 | **/android/**/gradle-wrapper.jar 36 | **/android/.gradle 37 | **/android/captures/ 38 | **/android/gradlew 39 | **/android/gradlew.bat 40 | **/android/local.properties 41 | **/android/**/GeneratedPluginRegistrant.java 42 | 43 | # iOS/XCode related 44 | **/ios/**/*.mode1v3 45 | **/ios/**/*.mode2v3 46 | **/ios/**/*.moved-aside 47 | **/ios/**/*.pbxuser 48 | **/ios/**/*.perspectivev3 49 | **/ios/**/*sync/ 50 | **/ios/**/.sconsign.dblite 51 | **/ios/**/.tags* 52 | **/ios/**/.vagrant/ 53 | **/ios/**/DerivedData/ 54 | **/ios/**/Icon? 55 | **/ios/**/Pods/ 56 | **/ios/**/.symlinks/ 57 | **/ios/**/profile 58 | **/ios/**/xcuserdata 59 | **/ios/.generated/ 60 | **/ios/Flutter/App.framework 61 | **/ios/Flutter/Flutter.framework 62 | **/ios/Flutter/Generated.xcconfig 63 | **/ios/Flutter/app.flx 64 | **/ios/Flutter/app.zip 65 | **/ios/Flutter/flutter_assets/ 66 | **/ios/ServiceDefinitions.json 67 | **/ios/Runner/GeneratedPluginRegistrant.* 68 | 69 | # Exceptions to above rules. 70 | !**/ios/**/default.mode1v3 71 | !**/ios/**/default.mode2v3 72 | !**/ios/**/default.pbxuser 73 | !**/ios/**/default.perspectivev3 74 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 75 | example/.flutter-plugins-dependencies 76 | 77 | .vscode 78 | 79 | # FVM Version Cache 80 | .fvm/ 81 | .fvmrc -------------------------------------------------------------------------------- /example/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleDisplayName 8 | Example 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | example 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | $(FLUTTER_BUILD_NUMBER) 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIMainStoryboardFile 30 | Main 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | UIViewControllerBasedStatusBarAppearance 45 | 46 | CADisableMinimumFrameDurationOnPhone 47 | 48 | UIApplicationSupportsIndirectInputEvents 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /example/web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | example 33 | 34 | 35 | 39 | 40 | 41 | 42 | 43 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | android { 29 | compileSdkVersion flutter.compileSdkVersion 30 | ndkVersion flutter.ndkVersion 31 | 32 | compileOptions { 33 | sourceCompatibility JavaVersion.VERSION_1_8 34 | targetCompatibility JavaVersion.VERSION_1_8 35 | } 36 | 37 | kotlinOptions { 38 | jvmTarget = '1.8' 39 | } 40 | 41 | sourceSets { 42 | main.java.srcDirs += 'src/main/kotlin' 43 | } 44 | 45 | defaultConfig { 46 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 47 | applicationId "com.vanethos.example.example" 48 | // You can update the following values to match your application needs. 49 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration. 50 | minSdkVersion flutter.minSdkVersion 51 | targetSdkVersion flutter.targetSdkVersion 52 | versionCode flutterVersionCode.toInteger() 53 | versionName flutterVersionName 54 | } 55 | 56 | buildTypes { 57 | release { 58 | // TODO: Add your own signing config for the release build. 59 | // Signing with the debug keys for now, so `flutter run --release` works. 60 | signingConfig signingConfigs.debug 61 | } 62 | } 63 | } 64 | 65 | flutter { 66 | source '../..' 67 | } 68 | 69 | dependencies { 70 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 71 | } 72 | -------------------------------------------------------------------------------- /example/ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:connectivity_widget/connectivity_widget.dart'; 3 | 4 | void main() { 5 | /// Setup Connectivity Utils 6 | ConnectivityUtils.instance 7 | ..serverToPing = 8 | "https://gist.githubusercontent.com/Vanethos/dccc4b4605fc5c5aa4b9153dacc7391c/raw/355ccc0e06d0f84fdbdc83f5b8106065539d9781/gistfile1.txt" 9 | ..verifyResponseCallback = 10 | (response) => response.contains("This is a test!"); 11 | 12 | runApp(const MyApp()); 13 | } 14 | 15 | class MyApp extends StatelessWidget { 16 | const MyApp({super.key}); 17 | 18 | @override 19 | Widget build(BuildContext context) { 20 | //setup connectivity server to ping and callback 21 | 22 | return MaterialApp( 23 | title: 'Flutter Demo', 24 | theme: ThemeData( 25 | primarySwatch: Colors.blue, 26 | ), 27 | home: const MyHomePage(title: 'Connectivity Widget Demo'), 28 | ); 29 | } 30 | } 31 | 32 | class MyHomePage extends StatefulWidget { 33 | const MyHomePage({required this.title, super.key}); 34 | 35 | final String title; 36 | 37 | @override 38 | State createState() => _MyHomePageState(); 39 | } 40 | 41 | class _MyHomePageState extends State { 42 | int _counter = 0; 43 | 44 | void _incrementCounter() { 45 | setState(() { 46 | _counter++; 47 | }); 48 | } 49 | 50 | @override 51 | Widget build(BuildContext context) { 52 | return Scaffold( 53 | appBar: AppBar( 54 | title: Text(widget.title), 55 | ), 56 | body: ConnectivityWidget( 57 | onlineCallback: _incrementCounter, 58 | builder: (context, isOnline) => Center( 59 | child: Column( 60 | mainAxisAlignment: MainAxisAlignment.center, 61 | children: [ 62 | Text( 63 | isOnline ? 'Online' : 'Offline', 64 | style: TextStyle( 65 | fontSize: 30, color: isOnline ? Colors.green : Colors.red), 66 | ), 67 | const SizedBox( 68 | height: 20, 69 | ), 70 | const Text( 71 | 'Number of times we checked internet connection:', 72 | ), 73 | Text( 74 | '$_counter', 75 | style: Theme.of(context).textTheme.displayLarge, 76 | ), 77 | ], 78 | ), 79 | ), 80 | ), // This trailing comma makes auto-formatting nicer for build methods. 81 | ); 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # [3.0.0] 2 | * Updates [connectivity_plus] package to version 6.0.3 3 | 4 | # [2.0.0] 5 | * Updates Dart SDK to support versions until the next SDK release (4.0.0) 6 | * Updates [http] package to version 1.2.1 7 | * Updates [connectivity_plus] package to version 5.0.2 8 | 9 | # [1.6.0] 10 | * Adds [minSuccessCalls] to assure a minimum of [minSuccessCalls] success calls times before setting connection as true. Defaults to 1. 11 | 12 | # [1.5.0] 13 | * Adds [retries] to retry connection to server [retries] times before setting connection as false. Defaults to 0. 14 | 15 | # [1.4.0] 16 | * Added the [timeoutDuration] parameter 17 | 18 | # [1.3.0] 19 | * When doing a `[isPhoneConnected]`, we add values to the stream 20 | 21 | # [1.2.0] 22 | * By default, we show a loading indicator instead of assuming we have no internet connection 23 | 24 | # [1.1.0] 25 | * Fixes library tests 26 | * Adds [child] as a required parameter 27 | * Correctly dispose of resources 28 | 29 | # [1.0.0] 30 | * Null safety migration 31 | * Replaces `simple_connectivity` with `connectivity_plus` 32 | * Connection stream now only outputs distinct values 33 | * Removes the `ConnectivityBloc` 34 | * Rewrites `ConnectivityUtils` 35 | * adds Github Actions 36 | * adds tests 37 | * fixes misc bugs 38 | 39 | # [0.1.8] 40 | * Updates http dependency, via [#26](https://github.com/Vanethos/flutter_connectivity_widget/pull/26), thanks to jezer07 41 | # [0.1.7] 42 | * Set default `serverToPing` and `callback` values if set to null via [#19](https://github.com/Vanethos/flutter_connectivity_widget/pull/19) 43 | 44 | # [0.1.6] 45 | * Changed the default connectivity URL via [#13](https://github.com/Vanethos/flutter_connectivity_widget/pull/15) 46 | * Updated RxDart version via [15](https://github.com/Vanethos/flutter_connectivity_widget/pull/13) 47 | 48 | # [0.1.5] 49 | * Added `ConnectivityUtils.initialize` to initialize with the `serverToPing` and `callback`, so that the first time 50 | we check the internet access we ping the correct server and use the provided callback 51 | 52 | ## [0.1.4+1] 53 | * Update dependencies 54 | 55 | ## [0.1.4] 56 | * Change implementation from connectivity to simple_connectivity so that location-aware `Info-plist` 57 | strings are no longer required 58 | 59 | ## [0.1.3] 60 | * Fix Dio dependency still present in repo 61 | * Change example 62 | 63 | ## [0.1.2] 64 | * Update example 65 | * Remove Dio from dependencies 66 | 67 | ## [0.1.1] 68 | * Banner is invisible when there is no connection 69 | * Fixed issue of banner not showing when starting the app in offline mode 70 | 71 | ## [0.1.0+1] 72 | 73 | * Update RxDart Version 74 | 75 | ## [0.1.0] 76 | 77 | * Initial Release 78 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # connectivity_widget 2 | 3 | A widget that shows the user if the phone is connected to the internet or not 4 | 5 | This is accomplished not only by verifying the status of the mobile network and/or wifi, but also by pinging a remote server and verifying its response. 6 | 7 | ![Example](https://media.giphy.com/media/KDtcncGS3YufdzkKx5/giphy.gif) 8 | 9 | ## Using the ConnectivityWidget 10 | 11 | The ConnectivityWidget uses a `builder` function that provides you a `isOnline` flag to build different screens for offline or online mode. 12 | 13 | ```dart 14 | ConnectivityWidget( 15 | builder: (context, isOnline) => Center( 16 | child: Column( 17 | mainAxisAlignment: MainAxisAlignment.center, 18 | children: [ 19 | Text("${isOnline ? 'Online' : 'Offline'}", style: TextStyle(fontSize: 30, color: isOnline ? Colors.green : Colors.red),), 20 | SizedBox(height: 20,), 21 | Text( 22 | 'Number of times we connected to the internet:', 23 | ), 24 | Text( 25 | '$_counter', 26 | style: Theme.of(context).textTheme.display1, 27 | ), 28 | ], 29 | ), 30 | ) 31 | ``` 32 | 33 | It also provides both a `onlineCallback` and a `offlineCallback` that are called when the phone changes the connection state to online and offline, respectively. 34 | 35 | ```dart 36 | ConnectivityWidget( 37 | onlineCallback: _incrementCounter, 38 | builder: //..., 39 | ) 40 | ``` 41 | 42 | If there is a need to change the default offline banner, a Widget can be provided to the `offlineBanner` parameter. Additionally, its visibility can be enabled or disabled by using the `showOfflineBanner` parameter. 43 | 44 | ## Configurable Parameters: 45 | - `serverToPing`; 46 | - `timeoutDuration`; 47 | - `debounceDuration`; 48 | - `verifyResponseCallback`; 49 | 50 | ## Changing the server to ping and the response verification 51 | 52 | By default, the Connectivity Widget checks if there is a connection to `http://www.google.com`. If you want to check the availability of a custom endpoint, you can set a new endpoint to ping and a callback to verify the response. 53 | 54 | ```dart 55 | ConnectivityUtils.instance.setCallback((response) => response.contains("This is a test!")); 56 | ConnectivityUtils.instance.setServerToPing("https://gist.githubusercontent.com/Vanethos/dccc4b4605fc5c5aa4b9153dacc7391c/raw/355ccc0e06d0f84fdbdc83f5b8106065539d9781/gistfile1.txt"); 57 | ``` 58 | 59 | ### Using ConnectivityUtils to Listen to Network Changes 60 | 61 | This library also provides access to the `ConnectivityUtils` class in which you can verify the status of the network. 62 | 63 | ```dart 64 | Stream ConnectivityUtils.instance.isPhoneConnectedStream // gets the current status of the network 65 | Future ConnectivityUtils.instance.isPhoneConnected() // future that determines network status 66 | ``` 67 | 68 | #### Note on Web: 69 | 70 | Although we can verify the status of the connection in web, what happens is that browsers will cache a request to a specific endpoint, so 71 | we cannot verify for certain if the connection is down or if we are using cache, using the methods presented in this package. 72 | 73 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 52 | 54 | 60 | 61 | 62 | 63 | 69 | 71 | 77 | 78 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /lib/src/connectivity_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:stream_disposable/stream_disposable.dart'; 3 | 4 | import '../connectivity_widget.dart'; 5 | 6 | /// Builder method with [isOnline] parameter to build widgets 7 | /// in function of the connectivity status 8 | typedef Widget ConnectivityBuilder(BuildContext context, bool isOnline); 9 | 10 | /// Connectivity Widget 11 | /// 12 | /// Widget that is aware of the network status from the network. 13 | /// 14 | /// Has a a [builder] parameter so that the child widget can be built in 15 | /// accordance to the online/offline status. 16 | /// 17 | /// A [onlineCallback] and [offlineCallback] are provided so that methods can 18 | /// be called when the device is turned online or offline, respectively 19 | /// 20 | /// [offlineBanner] is the banner to be shown at the bottom of the child widget 21 | /// created in the [builder]. Its visibility can be switched off with the [offlineBanner] 22 | /// parameter 23 | /// 24 | /// Example: 25 | /// 26 | /// ``` 27 | /// ConnectivityWidget( 28 | /// onlineCallback: _incrementCounter, 29 | /// builder: (context, isOnline) => Center( 30 | /// child: Column( 31 | /// mainAxisAlignment: MainAxisAlignment.center, 32 | /// children: [ 33 | /// Text("${isOnline ? 'Online' : 'Offline'}", style: TextStyle(fontSize: 30, color: isOnline ? Colors.green : Colors.red),), 34 | /// SizedBox(height: 20,), 35 | /// Text( 36 | /// 'Number of times we connected to the internet:', 37 | /// ), 38 | /// Text( 39 | /// '$_counter', 40 | /// style: Theme.of(context).textTheme.display1, 41 | /// ), 42 | /// ], 43 | /// ), 44 | /// ), 45 | /// ) 46 | /// ``` 47 | class ConnectivityWidget extends StatefulWidget { 48 | /// Builder method for the child widget. 49 | /// 50 | /// Provides a [iSOnline] parameter and a [context] to build the child 51 | final ConnectivityBuilder builder; 52 | 53 | /// Callback for when the device is online 54 | /// 55 | /// Example: 56 | /// 57 | /// `onlineCallback: () => _incrementCounter()` 58 | final VoidCallback? onlineCallback; 59 | 60 | /// Callback for when the device is offline 61 | /// 62 | /// Example: 63 | /// 64 | /// `onlineCallback: () => _decrementCounter()` 65 | final VoidCallback? offlineCallback; 66 | 67 | /// OfflineBanner to be shown at the bottom of the widget 68 | /// 69 | /// If none is provided, the [NoConnectivityBanner] is shown 70 | final Widget? offlineBanner; 71 | 72 | /// Flag to show or hide the [offlineBanner] 73 | final bool showOfflineBanner; 74 | 75 | /// Disables animations 76 | final bool disableAnimations; 77 | 78 | /// Loader widget to show while the first connection check is in progress 79 | final Widget? initialLoadingWidget; 80 | 81 | ConnectivityWidget( 82 | {required this.builder, 83 | this.onlineCallback, 84 | this.offlineCallback, 85 | this.showOfflineBanner = true, 86 | this.disableAnimations = false, 87 | this.offlineBanner, 88 | this.initialLoadingWidget, 89 | Key? key}) 90 | : super(key: key); 91 | 92 | @override 93 | State createState() => ConnectivityWidgetState(); 94 | } 95 | 96 | class ConnectivityWidgetState extends State 97 | with SingleTickerProviderStateMixin { 98 | late bool _dontAnimate; 99 | 100 | AnimationController? _animationController; 101 | 102 | StreamDisposable _disposable = StreamDisposable(); 103 | 104 | Stream _connectedStream = 105 | ConnectivityUtils.instance.isPhoneConnectedStream; 106 | 107 | @override 108 | @mustCallSuper 109 | void initState() { 110 | super.initState(); 111 | 112 | _dontAnimate = widget.disableAnimations; 113 | 114 | _animationController = AnimationController( 115 | duration: const Duration(milliseconds: 500), 116 | vsync: this, 117 | ); 118 | 119 | if (!_dontAnimate && 120 | !(ConnectivityUtils.instance.getPhoneConnection ?? false)) { 121 | this._dontAnimate = true; 122 | this._animationController?.value = 1.0; 123 | } 124 | 125 | _disposable.add( 126 | _connectedStream.listen( 127 | (status) { 128 | /// At the start, if we have a status set, we must consider that we came from another screen with that status 129 | if (!_dontAnimate) { 130 | this._dontAnimate = true; 131 | if (!(ConnectivityUtils.instance.getPhoneConnection ?? false)) { 132 | this._animationController?.value = 1.0; 133 | } 134 | return; 135 | } 136 | 137 | if (!status) { 138 | this._animationController?.forward(); 139 | if (widget.offlineCallback != null) widget.offlineCallback!(); 140 | } else { 141 | this._animationController?.reverse(); 142 | if (widget.onlineCallback != null) widget.onlineCallback!(); 143 | } 144 | this._dontAnimate = true; 145 | }, 146 | ), 147 | ); 148 | } 149 | 150 | @override 151 | Widget build(BuildContext context) { 152 | Widget child = StreamBuilder( 153 | stream: _connectedStream, 154 | builder: (context, snapshot) { 155 | if (snapshot.connectionState == ConnectionState.waiting) { 156 | return widget.initialLoadingWidget ?? 157 | Center( 158 | child: CircularProgressIndicator(), 159 | ); 160 | } 161 | 162 | return Stack( 163 | children: [ 164 | widget.builder.call(context, snapshot.data ?? true), 165 | if (widget.showOfflineBanner && 166 | !(snapshot.data ?? true) && 167 | _animationController != null) 168 | Align( 169 | alignment: Alignment.bottomCenter, 170 | child: SlideTransition( 171 | position: _animationController!.drive( 172 | Tween( 173 | begin: const Offset(0.0, 1.0), 174 | end: Offset.zero, 175 | ).chain( 176 | CurveTween( 177 | curve: Curves.fastOutSlowIn, 178 | ), 179 | ), 180 | ), 181 | child: widget.offlineBanner ?? NoConnectivityBanner(), 182 | ), 183 | ) 184 | ], 185 | ); 186 | }, 187 | ); 188 | return child; 189 | } 190 | 191 | @override 192 | void dispose() { 193 | _animationController?.dispose(); 194 | _disposable.dispose(); 195 | super.dispose(); 196 | } 197 | } 198 | 199 | /// Default Banner for offline mode 200 | class NoConnectivityBanner extends StatelessWidget { 201 | @override 202 | Widget build(BuildContext context) { 203 | return Container( 204 | padding: EdgeInsets.all(8), 205 | width: double.infinity, 206 | color: Colors.red, 207 | child: Text( 208 | "No connectivity", 209 | style: TextStyle( 210 | fontSize: 16, 211 | color: Colors.white, 212 | fontWeight: FontWeight.bold, 213 | ), 214 | textAlign: TextAlign.center, 215 | ), 216 | ); 217 | } 218 | } 219 | -------------------------------------------------------------------------------- /lib/src/connectivity_utils.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:math'; 3 | 4 | import 'package:connectivity_plus/connectivity_plus.dart'; 5 | import 'package:flutter/material.dart'; 6 | import 'package:retry/retry.dart'; 7 | import 'package:rxdart/rxdart.dart'; 8 | 9 | import 'package:http/http.dart' as http; 10 | 11 | import 'event.dart'; 12 | 13 | /// Callback to verify the response of the pinged server 14 | typedef VerifyResponseCallback = bool Function(String response); 15 | 16 | /// Connectivity Utils 17 | /// 18 | /// Helper class to determine phone connectivity 19 | class ConnectivityUtils { 20 | /// Server to ping 21 | /// 22 | /// The server to ping and check the response, can be set with [setServerToPing] 23 | late String _serverToPing; 24 | 25 | /// Verify Response Callback 26 | /// 27 | /// Callback to verify the response of the [_serverToPing] 28 | VerifyResponseCallback? _verifyResponseCallback; 29 | 30 | /// Duration after which we verify again the 31 | /// connectivity status, defaults to 3 seconds 32 | late Duration _debounceDuration; 33 | 34 | // When doing the http call to verify if we are connected, we fail with 35 | // a timeout after 3 seconds 36 | late Duration _timeoutDuration; 37 | 38 | /// If set to 0, as soon as the first call has an error, [isPhoneConnectedStream] changes state. 39 | /// Else, it will retry the call [retries] times before changing the state on 40 | /// [isPhoneConnectedStream] 41 | late int _retries; 42 | 43 | /// The number of consecutive successfull calls needed for the system to state that 44 | /// there is a valid internet connection. 45 | /// 46 | /// Defaults to 1, meaning that the first valid call validates the system as connected 47 | /// to the internet 48 | late int _minSuccessCalls; 49 | 50 | late Connectivity _connectivity; 51 | 52 | late http.Client _httpClient; 53 | 54 | int _currentSuccessCalls = 0; 55 | 56 | int _currentErrorCalls = 0; 57 | 58 | /// Connectivity on/off events 59 | BehaviorSubject _connectivitySubject = BehaviorSubject(); 60 | 61 | Stream get isPhoneConnectedStream => 62 | _connectivitySubject.stream.distinct(); 63 | 64 | bool? get getPhoneConnection => _connectivitySubject.valueOrNull; 65 | 66 | /// Event to check the network status 67 | PublishSubject _getConnectivityStatusSubject = PublishSubject(); 68 | 69 | Sink get getConnectivityStatusSink => 70 | _getConnectivityStatusSubject.sink; 71 | 72 | static ConnectivityUtils? _instance; 73 | 74 | static ConnectivityUtils get instance { 75 | _instance ??= ConnectivityUtils._(); 76 | return _instance!; 77 | } 78 | 79 | @visibleForTesting 80 | static void setInstance(ConnectivityUtils utils) { 81 | _instance = utils; 82 | } 83 | 84 | @visibleForTesting 85 | static ConnectivityUtils createTestingInstance( 86 | Connectivity connectivity, 87 | http.Client httpClient, 88 | ) { 89 | _instance = ConnectivityUtils.test( 90 | connectivity: connectivity, 91 | httpClient: httpClient, 92 | ); 93 | return _instance!; 94 | } 95 | 96 | @visibleForTesting 97 | ConnectivityUtils.test({ 98 | required Connectivity connectivity, 99 | required http.Client httpClient, 100 | int retries = 0, 101 | int minSuccessCalls = 1, 102 | String? serverToPing, 103 | }) : _httpClient = httpClient, 104 | _connectivity = connectivity, 105 | _serverToPing = serverToPing ?? "http://www.gstatic.com/generate_204", 106 | _debounceDuration = Duration(seconds: 3), 107 | _timeoutDuration = Duration(seconds: 2), 108 | _retries = retries, 109 | _minSuccessCalls = minSuccessCalls { 110 | _init(); 111 | } 112 | 113 | ConnectivityUtils._() 114 | : _connectivity = Connectivity(), 115 | _httpClient = http.Client(), 116 | _serverToPing = "http://www.gstatic.com/generate_204", 117 | _debounceDuration = Duration(seconds: 3), 118 | _timeoutDuration = Duration(seconds: 2), 119 | _retries = 0, 120 | _minSuccessCalls = 1 { 121 | _init(); 122 | } 123 | 124 | void _init() { 125 | _connectivity.onConnectivityChanged.listen((result) { 126 | if (!_getConnectivityStatusSubject.isClosed) { 127 | _getConnectivityStatusSubject.add(Event()); 128 | } 129 | }, onError: (_) { 130 | if (!_getConnectivityStatusSubject.isClosed) { 131 | _getConnectivityStatusSubject.add(Event()); 132 | } 133 | }); 134 | 135 | /// Stream that receives events and verifies the network status 136 | _getConnectivityStatusSubject.stream 137 | .asyncMap((_) => isPhoneConnected()) 138 | .listen((value) async { 139 | /// Every duration we will ping the service to see if we are live 140 | await Future.delayed(_debounceDuration); 141 | if (!_getConnectivityStatusSubject.isClosed) { 142 | _getConnectivityStatusSubject.add(Event()); 143 | } 144 | }, onError: (error) async { 145 | if (!(_connectivitySubject.valueOrNull ?? false)) { 146 | if (!_connectivitySubject.isClosed) { 147 | _connectivitySubject.add(false); 148 | } 149 | } 150 | // if we are offline, retry until we are online 151 | await Future.delayed(_debounceDuration); 152 | if (!_getConnectivityStatusSubject.isClosed) { 153 | _getConnectivityStatusSubject.add(Event()); 154 | } 155 | }); 156 | 157 | _getConnectivityStatusSubject.add(Event()); 158 | } 159 | 160 | /// Sets a new server to ping 161 | set serverToPing(String serverToPing) { 162 | this._serverToPing = serverToPing; 163 | if (!_getConnectivityStatusSubject.isClosed) { 164 | _getConnectivityStatusSubject.add(Event()); 165 | } 166 | } 167 | 168 | String get serverToPing => _serverToPing; 169 | 170 | /// Sets a new VerifyResponseCallback 171 | set verifyResponseCallback(VerifyResponseCallback callback) { 172 | this._verifyResponseCallback = callback; 173 | if (!_getConnectivityStatusSubject.isClosed) { 174 | _getConnectivityStatusSubject.add(Event()); 175 | } 176 | } 177 | 178 | /// Sets a new Duration for the verification 179 | set debounceDuration(Duration duration) { 180 | this._debounceDuration = duration; 181 | if (!_getConnectivityStatusSubject.isClosed) { 182 | _getConnectivityStatusSubject.add(Event()); 183 | } 184 | } 185 | 186 | /// Sets a new Duration for the timeout 187 | set timeoutDuration(Duration duration) { 188 | this.timeoutDuration = duration; 189 | if (!_getConnectivityStatusSubject.isClosed) { 190 | _getConnectivityStatusSubject.add(Event()); 191 | } 192 | } 193 | 194 | Duration get debounceDuration => this._debounceDuration; 195 | 196 | /// Sets a new number of tries before setting connection to false 197 | set retries(int retries) { 198 | this._retries = retries; 199 | if (!_getConnectivityStatusSubject.isClosed) { 200 | _getConnectivityStatusSubject.add(Event()); 201 | } 202 | } 203 | 204 | /// Sets a new number of success calls before setting connection to true 205 | set minSuccessCalls(int minSuccessCalls) { 206 | this._minSuccessCalls = minSuccessCalls; 207 | if (!_getConnectivityStatusSubject.isClosed) { 208 | _getConnectivityStatusSubject.add(Event()); 209 | } 210 | } 211 | 212 | /// Checkf if phone is connected to the internet 213 | /// 214 | /// This method tries to access google.com to verify for 215 | /// internet connection 216 | /// 217 | /// returns [Future] with value [true] of connected to the 218 | /// internet 219 | Future isPhoneConnected() async { 220 | try { 221 | final result = await retry( 222 | () => _httpClient 223 | .get( 224 | Uri.parse(_serverToPing), 225 | ) 226 | .timeout( 227 | _timeoutDuration, 228 | onTimeout: () => throw TimeoutException( 229 | 'Exceeded timeout time', 230 | ), 231 | ) 232 | .then( 233 | (result) { 234 | if (result.statusCode > 199 && 235 | result.statusCode < 400 && 236 | (_verifyResponseCallback?.call(result.body) ?? true)) { 237 | _currentSuccessCalls++; 238 | _currentErrorCalls = 0; 239 | 240 | if (_currentSuccessCalls < _minSuccessCalls) { 241 | throw _InsufficientConsecutiveCallsException(); 242 | } 243 | 244 | _currentSuccessCalls = 0; 245 | return true; 246 | } 247 | 248 | _currentErrorCalls++; 249 | throw TimeoutException("Exceeded timeout time between calls"); 250 | }, 251 | ), 252 | retryIf: (exc) => 253 | exc is _InsufficientConsecutiveCallsException && 254 | _currentSuccessCalls < _minSuccessCalls || 255 | exc is TimeoutException && _currentErrorCalls < _retries, 256 | maxAttempts: max(_retries, _minSuccessCalls), 257 | ); 258 | 259 | _currentSuccessCalls = 0; 260 | _currentErrorCalls = 0; 261 | 262 | if (result) { 263 | _connectivitySubject.add(true); 264 | return true; 265 | } 266 | } catch (e) { 267 | _currentSuccessCalls = 0; 268 | _currentErrorCalls = 0; 269 | _connectivitySubject.add(false); 270 | return false; 271 | } 272 | _connectivitySubject.add(false); 273 | return false; 274 | } 275 | 276 | Future dispose() async { 277 | await _connectivitySubject.close(); 278 | await _getConnectivityStatusSubject.close(); 279 | } 280 | } 281 | 282 | /// Helper exception to signal a success call 283 | class _InsufficientConsecutiveCallsException implements Exception {} 284 | -------------------------------------------------------------------------------- /example/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | args: 5 | dependency: transitive 6 | description: 7 | name: args 8 | sha256: "7cf60b9f0cc88203c5a190b4cd62a99feea42759a7fa695010eb5de1c0b2252a" 9 | url: "https://pub.dev" 10 | source: hosted 11 | version: "2.5.0" 12 | async: 13 | dependency: transitive 14 | description: 15 | name: async 16 | sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" 17 | url: "https://pub.dev" 18 | source: hosted 19 | version: "2.11.0" 20 | boolean_selector: 21 | dependency: transitive 22 | description: 23 | name: boolean_selector 24 | sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" 25 | url: "https://pub.dev" 26 | source: hosted 27 | version: "2.1.1" 28 | characters: 29 | dependency: transitive 30 | description: 31 | name: characters 32 | sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" 33 | url: "https://pub.dev" 34 | source: hosted 35 | version: "1.3.0" 36 | clock: 37 | dependency: transitive 38 | description: 39 | name: clock 40 | sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf 41 | url: "https://pub.dev" 42 | source: hosted 43 | version: "1.1.1" 44 | collection: 45 | dependency: transitive 46 | description: 47 | name: collection 48 | sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a 49 | url: "https://pub.dev" 50 | source: hosted 51 | version: "1.18.0" 52 | connectivity_plus: 53 | dependency: transitive 54 | description: 55 | name: connectivity_plus 56 | sha256: db7a4e143dc72cc3cb2044ef9b052a7ebfe729513e6a82943bc3526f784365b8 57 | url: "https://pub.dev" 58 | source: hosted 59 | version: "6.0.3" 60 | connectivity_plus_platform_interface: 61 | dependency: transitive 62 | description: 63 | name: connectivity_plus_platform_interface 64 | sha256: b6a56efe1e6675be240de39107281d4034b64ac23438026355b4234042a35adb 65 | url: "https://pub.dev" 66 | source: hosted 67 | version: "2.0.0" 68 | connectivity_widget: 69 | dependency: "direct main" 70 | description: 71 | path: ".." 72 | relative: true 73 | source: path 74 | version: "2.0.0" 75 | dbus: 76 | dependency: transitive 77 | description: 78 | name: dbus 79 | sha256: "365c771ac3b0e58845f39ec6deebc76e3276aa9922b0cc60840712094d9047ac" 80 | url: "https://pub.dev" 81 | source: hosted 82 | version: "0.7.10" 83 | fake_async: 84 | dependency: transitive 85 | description: 86 | name: fake_async 87 | sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" 88 | url: "https://pub.dev" 89 | source: hosted 90 | version: "1.3.1" 91 | ffi: 92 | dependency: transitive 93 | description: 94 | name: ffi 95 | sha256: "493f37e7df1804778ff3a53bd691d8692ddf69702cf4c1c1096a2e41b4779e21" 96 | url: "https://pub.dev" 97 | source: hosted 98 | version: "2.1.2" 99 | flutter: 100 | dependency: "direct main" 101 | description: flutter 102 | source: sdk 103 | version: "0.0.0" 104 | flutter_lints: 105 | dependency: "direct dev" 106 | description: 107 | name: flutter_lints 108 | sha256: "3f41d009ba7172d5ff9be5f6e6e6abb4300e263aab8866d2a0842ed2a70f8f0c" 109 | url: "https://pub.dev" 110 | source: hosted 111 | version: "4.0.0" 112 | flutter_test: 113 | dependency: "direct dev" 114 | description: flutter 115 | source: sdk 116 | version: "0.0.0" 117 | flutter_web_plugins: 118 | dependency: transitive 119 | description: flutter 120 | source: sdk 121 | version: "0.0.0" 122 | http: 123 | dependency: transitive 124 | description: 125 | name: http 126 | sha256: "761a297c042deedc1ffbb156d6e2af13886bb305c2a343a4d972504cd67dd938" 127 | url: "https://pub.dev" 128 | source: hosted 129 | version: "1.2.1" 130 | http_parser: 131 | dependency: transitive 132 | description: 133 | name: http_parser 134 | sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" 135 | url: "https://pub.dev" 136 | source: hosted 137 | version: "4.0.2" 138 | leak_tracker: 139 | dependency: transitive 140 | description: 141 | name: leak_tracker 142 | sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a" 143 | url: "https://pub.dev" 144 | source: hosted 145 | version: "10.0.4" 146 | leak_tracker_flutter_testing: 147 | dependency: transitive 148 | description: 149 | name: leak_tracker_flutter_testing 150 | sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8" 151 | url: "https://pub.dev" 152 | source: hosted 153 | version: "3.0.3" 154 | leak_tracker_testing: 155 | dependency: transitive 156 | description: 157 | name: leak_tracker_testing 158 | sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" 159 | url: "https://pub.dev" 160 | source: hosted 161 | version: "3.0.1" 162 | lints: 163 | dependency: transitive 164 | description: 165 | name: lints 166 | sha256: "976c774dd944a42e83e2467f4cc670daef7eed6295b10b36ae8c85bcbf828235" 167 | url: "https://pub.dev" 168 | source: hosted 169 | version: "4.0.0" 170 | matcher: 171 | dependency: transitive 172 | description: 173 | name: matcher 174 | sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb 175 | url: "https://pub.dev" 176 | source: hosted 177 | version: "0.12.16+1" 178 | material_color_utilities: 179 | dependency: transitive 180 | description: 181 | name: material_color_utilities 182 | sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" 183 | url: "https://pub.dev" 184 | source: hosted 185 | version: "0.8.0" 186 | meta: 187 | dependency: transitive 188 | description: 189 | name: meta 190 | sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136" 191 | url: "https://pub.dev" 192 | source: hosted 193 | version: "1.12.0" 194 | nm: 195 | dependency: transitive 196 | description: 197 | name: nm 198 | sha256: "2c9aae4127bdc8993206464fcc063611e0e36e72018696cd9631023a31b24254" 199 | url: "https://pub.dev" 200 | source: hosted 201 | version: "0.5.0" 202 | path: 203 | dependency: transitive 204 | description: 205 | name: path 206 | sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" 207 | url: "https://pub.dev" 208 | source: hosted 209 | version: "1.9.0" 210 | petitparser: 211 | dependency: transitive 212 | description: 213 | name: petitparser 214 | sha256: c15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27 215 | url: "https://pub.dev" 216 | source: hosted 217 | version: "6.0.2" 218 | plugin_platform_interface: 219 | dependency: transitive 220 | description: 221 | name: plugin_platform_interface 222 | sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" 223 | url: "https://pub.dev" 224 | source: hosted 225 | version: "2.1.8" 226 | retry: 227 | dependency: transitive 228 | description: 229 | name: retry 230 | sha256: "822e118d5b3aafed083109c72d5f484c6dc66707885e07c0fbcb8b986bba7efc" 231 | url: "https://pub.dev" 232 | source: hosted 233 | version: "3.1.2" 234 | rxdart: 235 | dependency: transitive 236 | description: 237 | name: rxdart 238 | sha256: "0c7c0cedd93788d996e33041ffecda924cc54389199cde4e6a34b440f50044cb" 239 | url: "https://pub.dev" 240 | source: hosted 241 | version: "0.27.7" 242 | sky_engine: 243 | dependency: transitive 244 | description: flutter 245 | source: sdk 246 | version: "0.0.99" 247 | source_span: 248 | dependency: transitive 249 | description: 250 | name: source_span 251 | sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" 252 | url: "https://pub.dev" 253 | source: hosted 254 | version: "1.10.0" 255 | stack_trace: 256 | dependency: transitive 257 | description: 258 | name: stack_trace 259 | sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" 260 | url: "https://pub.dev" 261 | source: hosted 262 | version: "1.11.1" 263 | stream_channel: 264 | dependency: transitive 265 | description: 266 | name: stream_channel 267 | sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 268 | url: "https://pub.dev" 269 | source: hosted 270 | version: "2.1.2" 271 | stream_disposable: 272 | dependency: transitive 273 | description: 274 | name: stream_disposable 275 | sha256: ed15757404db8f27be667dd9f9606cf5adb89911b7227b246638970f04b3515d 276 | url: "https://pub.dev" 277 | source: hosted 278 | version: "2.0.0" 279 | string_scanner: 280 | dependency: transitive 281 | description: 282 | name: string_scanner 283 | sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" 284 | url: "https://pub.dev" 285 | source: hosted 286 | version: "1.2.0" 287 | term_glyph: 288 | dependency: transitive 289 | description: 290 | name: term_glyph 291 | sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 292 | url: "https://pub.dev" 293 | source: hosted 294 | version: "1.2.1" 295 | test_api: 296 | dependency: transitive 297 | description: 298 | name: test_api 299 | sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f" 300 | url: "https://pub.dev" 301 | source: hosted 302 | version: "0.7.0" 303 | typed_data: 304 | dependency: transitive 305 | description: 306 | name: typed_data 307 | sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c 308 | url: "https://pub.dev" 309 | source: hosted 310 | version: "1.3.2" 311 | vector_math: 312 | dependency: transitive 313 | description: 314 | name: vector_math 315 | sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" 316 | url: "https://pub.dev" 317 | source: hosted 318 | version: "2.1.4" 319 | vm_service: 320 | dependency: transitive 321 | description: 322 | name: vm_service 323 | sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec" 324 | url: "https://pub.dev" 325 | source: hosted 326 | version: "14.2.1" 327 | web: 328 | dependency: transitive 329 | description: 330 | name: web 331 | sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27" 332 | url: "https://pub.dev" 333 | source: hosted 334 | version: "0.5.1" 335 | xml: 336 | dependency: transitive 337 | description: 338 | name: xml 339 | sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226 340 | url: "https://pub.dev" 341 | source: hosted 342 | version: "6.5.0" 343 | sdks: 344 | dart: ">=3.3.0 <4.0.0" 345 | flutter: ">=3.18.0-18.0.pre.54" 346 | -------------------------------------------------------------------------------- /test/connectivity_widget_test.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:connectivity_widget/connectivity_widget.dart'; 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter_test/flutter_test.dart'; 6 | import 'package:mocktail/mocktail.dart'; 7 | 8 | import 'mocks.dart'; 9 | 10 | void main() { 11 | group('ConnectivityWidget', () { 12 | late ConnectivityUtils utils; 13 | 14 | testWidgets('when we have no connection, we show the default widget', 15 | (tester) async { 16 | utils = MockConnectivityUtils(); 17 | 18 | when(() => utils.getPhoneConnection).thenReturn(false); 19 | when(() => utils.isPhoneConnectedStream).thenAnswer( 20 | (_) => Stream.value(false).asBroadcastStream(), 21 | ); 22 | 23 | ConnectivityUtils.setInstance(utils); 24 | 25 | await tester.pumpWidget(TestShell( 26 | widget: ConnectivityWidget( 27 | builder: (context, isOnline) { 28 | return Container(); 29 | }, 30 | ), 31 | )); 32 | 33 | await tester.pumpAndSettle(); 34 | 35 | expect(find.byType(NoConnectivityBanner), findsOneWidget); 36 | }); 37 | 38 | testWidgets('when we have connection, we show don\'t the default widget', 39 | (tester) async { 40 | utils = MockConnectivityUtils(); 41 | 42 | when(() => utils.getPhoneConnection).thenReturn(true); 43 | when(() => utils.isPhoneConnectedStream).thenAnswer( 44 | (_) => Stream.value(true).asBroadcastStream(), 45 | ); 46 | 47 | ConnectivityUtils.setInstance(utils); 48 | 49 | await tester.pumpWidget(TestShell( 50 | widget: ConnectivityWidget( 51 | builder: (context, isOnline) { 52 | return Container(); 53 | }, 54 | ), 55 | )); 56 | 57 | await tester.pumpAndSettle(); 58 | 59 | expect(find.byType(NoConnectivityBanner), findsNothing); 60 | }); 61 | 62 | testWidgets('we show custom banner when offline', (tester) async { 63 | utils = MockConnectivityUtils(); 64 | 65 | when(() => utils.getPhoneConnection).thenReturn(false); 66 | when(() => utils.isPhoneConnectedStream).thenAnswer( 67 | (_) => Stream.value(false).asBroadcastStream(), 68 | ); 69 | 70 | ConnectivityUtils.setInstance(utils); 71 | 72 | await tester.pumpWidget(TestShell( 73 | widget: ConnectivityWidget( 74 | offlineBanner: CustomBanner(), 75 | builder: (context, isOnline) { 76 | return Container(); 77 | }, 78 | ), 79 | )); 80 | 81 | await tester.pumpAndSettle(); 82 | 83 | expect(find.byType(CustomBanner), findsOneWidget); 84 | }); 85 | 86 | testWidgets('if showOfflineBanner is false, we don\'t show the banner', 87 | (tester) async { 88 | utils = MockConnectivityUtils(); 89 | 90 | when(() => utils.getPhoneConnection).thenReturn(false); 91 | when(() => utils.isPhoneConnectedStream).thenAnswer( 92 | (_) => Stream.value(false).asBroadcastStream(), 93 | ); 94 | 95 | ConnectivityUtils.setInstance(utils); 96 | 97 | await tester.pumpWidget(TestShell( 98 | widget: ConnectivityWidget( 99 | showOfflineBanner: false, 100 | builder: (context, isOnline) { 101 | return Container(); 102 | }, 103 | ), 104 | )); 105 | 106 | await tester.pumpAndSettle(); 107 | 108 | expect(find.byType(NoConnectivityBanner), findsNothing); 109 | }); 110 | 111 | testWidgets('we don\'t show custom banner when online', (tester) async { 112 | utils = MockConnectivityUtils(); 113 | 114 | when(() => utils.getPhoneConnection).thenReturn(true); 115 | when(() => utils.isPhoneConnectedStream).thenAnswer( 116 | (_) => Stream.value(true).asBroadcastStream(), 117 | ); 118 | 119 | ConnectivityUtils.setInstance(utils); 120 | 121 | await tester.pumpWidget(TestShell( 122 | widget: ConnectivityWidget( 123 | offlineBanner: CustomBanner(), 124 | builder: (context, isOnline) { 125 | return Container(); 126 | }, 127 | ), 128 | )); 129 | 130 | await tester.pumpAndSettle(); 131 | 132 | expect(find.byType(CustomBanner), findsNothing); 133 | }); 134 | 135 | testWidgets('we show our child widget when offline', (tester) async { 136 | utils = MockConnectivityUtils(); 137 | 138 | when(() => utils.getPhoneConnection).thenReturn(false); 139 | when(() => utils.isPhoneConnectedStream).thenAnswer( 140 | (_) => Stream.value(false).asBroadcastStream(), 141 | ); 142 | 143 | final child = Text("Bananas"); 144 | 145 | ConnectivityUtils.setInstance(utils); 146 | 147 | await tester.pumpWidget(TestShell( 148 | widget: ConnectivityWidget( 149 | showOfflineBanner: false, 150 | builder: (context, isOnline) { 151 | return child; 152 | }, 153 | ), 154 | )); 155 | 156 | await tester.pumpAndSettle(); 157 | 158 | expect(find.byWidget(child), findsOneWidget); 159 | }); 160 | 161 | testWidgets('we show our child widget when online', (tester) async { 162 | utils = MockConnectivityUtils(); 163 | 164 | when(() => utils.getPhoneConnection).thenReturn(true); 165 | when(() => utils.isPhoneConnectedStream).thenAnswer( 166 | (_) => Stream.value(true).asBroadcastStream(), 167 | ); 168 | 169 | final child = Text("Bananas"); 170 | 171 | ConnectivityUtils.setInstance(utils); 172 | 173 | await tester.pumpWidget(TestShell( 174 | widget: ConnectivityWidget( 175 | showOfflineBanner: false, 176 | builder: (context, isOnline) { 177 | return child; 178 | }, 179 | ), 180 | )); 181 | 182 | await tester.pumpAndSettle(); 183 | 184 | expect(find.byWidget(child), findsOneWidget); 185 | }); 186 | 187 | testWidgets('offlineCallback is called only when going offline', 188 | (tester) async { 189 | utils = MockConnectivityUtils(); 190 | 191 | final controller = StreamController.broadcast(); 192 | 193 | when(() => utils.getPhoneConnection).thenReturn(true); 194 | when(() => utils.isPhoneConnectedStream) 195 | .thenAnswer((_) => controller.stream); 196 | 197 | int called = 0; 198 | 199 | ConnectivityUtils.setInstance(utils); 200 | 201 | await tester.pumpWidget(TestShell( 202 | widget: ConnectivityWidget( 203 | offlineCallback: () => called++, 204 | builder: (context, isOnline) { 205 | return Container(); 206 | }, 207 | ), 208 | )); 209 | 210 | controller.add(true); 211 | 212 | await tester.pumpAndSettle(); 213 | 214 | controller.add(false); 215 | 216 | await tester.pumpAndSettle(); 217 | 218 | expect(called, 1); 219 | 220 | await controller.close(); 221 | }); 222 | 223 | testWidgets('onlineCallback is called only when going online', 224 | (tester) async { 225 | utils = MockConnectivityUtils(); 226 | 227 | final controller = StreamController.broadcast(); 228 | 229 | when(() => utils.getPhoneConnection).thenReturn(false); 230 | when(() => utils.isPhoneConnectedStream) 231 | .thenAnswer((_) => controller.stream); 232 | 233 | int called = 0; 234 | 235 | ConnectivityUtils.setInstance(utils); 236 | 237 | await tester.pumpWidget(TestShell( 238 | widget: ConnectivityWidget( 239 | onlineCallback: () => called++, 240 | builder: (context, isOnline) { 241 | return Container(); 242 | }, 243 | ), 244 | )); 245 | 246 | controller.add(true); 247 | 248 | await tester.pumpAndSettle(); 249 | 250 | controller.add(false); 251 | 252 | await tester.pumpAndSettle(); 253 | 254 | expect(called, 1); 255 | 256 | await controller.close(); 257 | }); 258 | 259 | testWidgets('the loading widget is shown before we receive any data', 260 | (tester) async { 261 | utils = MockConnectivityUtils(); 262 | 263 | final controller = StreamController.broadcast(); 264 | 265 | when(() => utils.getPhoneConnection).thenReturn(false); 266 | when(() => utils.isPhoneConnectedStream) 267 | .thenAnswer((_) => controller.stream); 268 | 269 | ConnectivityUtils.setInstance(utils); 270 | 271 | final expectedText = "Loading the widget"; 272 | 273 | await tester.pumpWidget(TestShell( 274 | widget: ConnectivityWidget( 275 | initialLoadingWidget: Text(expectedText), 276 | builder: (context, isOnline) { 277 | return Container(); 278 | }, 279 | ), 280 | )); 281 | 282 | await tester.pump( 283 | Duration( 284 | milliseconds: 500, 285 | ), 286 | ); 287 | 288 | expect(find.text(expectedText), findsOneWidget); 289 | 290 | await controller.close(); 291 | }); 292 | 293 | testWidgets( 294 | 'by default, the loading widget is a [CircularProgressIndicator]', 295 | (tester) async { 296 | utils = MockConnectivityUtils(); 297 | 298 | final controller = StreamController.broadcast(); 299 | 300 | when(() => utils.getPhoneConnection).thenReturn(false); 301 | when(() => utils.isPhoneConnectedStream) 302 | .thenAnswer((_) => controller.stream); 303 | 304 | ConnectivityUtils.setInstance(utils); 305 | 306 | await tester.pumpWidget(TestShell( 307 | widget: ConnectivityWidget( 308 | builder: (context, isOnline) { 309 | return Container(); 310 | }, 311 | ), 312 | )); 313 | 314 | await tester.pump( 315 | Duration( 316 | milliseconds: 500, 317 | ), 318 | ); 319 | 320 | expect(find.byType(CircularProgressIndicator), findsOneWidget); 321 | 322 | await controller.close(); 323 | }); 324 | 325 | testWidgets('builder is called with correct value', (tester) async { 326 | utils = MockConnectivityUtils(); 327 | 328 | final controller = StreamController.broadcast(); 329 | 330 | when(() => utils.getPhoneConnection).thenReturn(false); 331 | when(() => utils.isPhoneConnectedStream) 332 | .thenAnswer((_) => controller.stream); 333 | 334 | bool? online; 335 | 336 | ConnectivityUtils.setInstance(utils); 337 | 338 | await tester.pumpWidget( 339 | TestShell( 340 | widget: ConnectivityWidget( 341 | builder: (context, isOnline) { 342 | online = isOnline; 343 | return Container(); 344 | }, 345 | ), 346 | ), 347 | ); 348 | 349 | controller.add(true); 350 | 351 | await tester.pump( 352 | Duration( 353 | milliseconds: 500, 354 | ), 355 | ); 356 | 357 | expect(online, isTrue); 358 | 359 | await controller.close(); 360 | }); 361 | 362 | testWidgets('builder is called with the updated value', (tester) async { 363 | utils = MockConnectivityUtils(); 364 | 365 | final controller = StreamController.broadcast(); 366 | 367 | when(() => utils.getPhoneConnection).thenReturn(false); 368 | when(() => utils.isPhoneConnectedStream) 369 | .thenAnswer((_) => controller.stream); 370 | 371 | bool? online; 372 | 373 | ConnectivityUtils.setInstance(utils); 374 | 375 | await tester.pumpWidget(TestShell( 376 | widget: ConnectivityWidget( 377 | builder: (context, isOnline) { 378 | online = isOnline; 379 | return Container(); 380 | }, 381 | ), 382 | )); 383 | 384 | controller.add(true); 385 | 386 | await tester.pump( 387 | Duration( 388 | milliseconds: 500, 389 | ), 390 | ); 391 | 392 | controller.add(false); 393 | 394 | await tester.pump( 395 | Duration( 396 | milliseconds: 500, 397 | ), 398 | ); 399 | 400 | expect(online, isFalse); 401 | 402 | await controller.close(); 403 | }); 404 | }); 405 | } 406 | 407 | class TestShell extends StatelessWidget { 408 | final Widget widget; 409 | 410 | const TestShell({required this.widget, Key? key}) : super(key: key); 411 | 412 | @override 413 | Widget build(BuildContext context) { 414 | return MaterialApp( 415 | home: widget, 416 | ); 417 | } 418 | } 419 | 420 | class CustomBanner extends StatelessWidget { 421 | const CustomBanner({Key? key}) : super(key: key); 422 | 423 | @override 424 | Widget build(BuildContext context) { 425 | return Container( 426 | color: Colors.red, 427 | height: 200, 428 | width: 200, 429 | ); 430 | } 431 | } 432 | -------------------------------------------------------------------------------- /test/connectivity_utils_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:connectivity_plus/connectivity_plus.dart'; 2 | import 'package:connectivity_widget/connectivity_widget.dart'; 3 | import 'package:connectivity_widget/src/event.dart'; 4 | import 'package:flutter_test/flutter_test.dart'; 5 | import 'package:mocktail/mocktail.dart'; 6 | import 'package:http/http.dart' as http; 7 | 8 | import 'mocks.dart'; 9 | 10 | void main() { 11 | group('ConnectivityUtils', () { 12 | late Connectivity connectivity; 13 | late http.Client client; 14 | late http.Response response; 15 | const serverToPing = "https://gpalma.pt"; 16 | const duration = Duration(milliseconds: 500); 17 | 18 | setUp(() { 19 | connectivity = MockConnectivity(); 20 | 21 | client = MockHttpClient(); 22 | 23 | response = MockResponse(); 24 | 25 | when(() => connectivity.onConnectivityChanged) 26 | .thenAnswer((_) => Stream.empty()); 27 | 28 | when(() => client.get(Uri.parse("http://www.gstatic.com/generate_204"))) 29 | .thenAnswer( 30 | (invocation) => Future.value( 31 | response, 32 | ), 33 | ); 34 | 35 | when(() => response.statusCode).thenReturn(200); 36 | when(() => response.body).thenReturn('bananas'); 37 | }); 38 | 39 | group('Setters', () { 40 | test("we can set serverToPing", () async { 41 | final utils = ConnectivityUtils.test( 42 | connectivity: connectivity, httpClient: client); 43 | utils.serverToPing = serverToPing; 44 | expect(utils.serverToPing, serverToPing); 45 | }); 46 | 47 | test("we can set duration", () async { 48 | final utils = ConnectivityUtils.test( 49 | connectivity: connectivity, httpClient: client); 50 | utils.debounceDuration = duration; 51 | expect(utils.debounceDuration, duration); 52 | }); 53 | }); 54 | 55 | group('isPhoneConnected', () { 56 | test('uses correct serverToPing', () async { 57 | final utils = ConnectivityUtils.test( 58 | connectivity: connectivity, httpClient: client); 59 | utils.serverToPing = serverToPing; 60 | when(() => client.get(Uri.parse(serverToPing))).thenAnswer( 61 | (invocation) => Future.value( 62 | response, 63 | ), 64 | ); 65 | when(() => response.statusCode).thenReturn(200); 66 | when(() => response.body).thenReturn('bananas'); 67 | await utils.isPhoneConnected(); 68 | expect(verify(() => client.get(Uri.parse(serverToPing))).callCount > 1, 69 | isTrue); 70 | }); 71 | 72 | test('correct status code returns true', () async { 73 | when(() => response.statusCode).thenReturn(200); 74 | when(() => response.body).thenReturn('bananas'); 75 | when(() => client.get(Uri.parse(serverToPing))).thenAnswer( 76 | (invocation) => Future.value( 77 | response, 78 | ), 79 | ); 80 | final utils = ConnectivityUtils.test( 81 | connectivity: connectivity, httpClient: client); 82 | utils.serverToPing = serverToPing; 83 | final result = await utils.isPhoneConnected(); 84 | expect(result, isTrue); 85 | }); 86 | 87 | test('incorrect status code returns false', () async { 88 | final utils = ConnectivityUtils.test( 89 | connectivity: connectivity, httpClient: client); 90 | utils.serverToPing = serverToPing; 91 | when(() => client.get(Uri.parse(serverToPing))).thenAnswer( 92 | (invocation) => Future.value( 93 | response, 94 | ), 95 | ); 96 | when(() => response.statusCode).thenReturn(500); 97 | when(() => response.body).thenReturn('bananas'); 98 | final result = await utils.isPhoneConnected(); 99 | expect(result, isFalse); 100 | }); 101 | 102 | test('if we exceed timeout, we return false', () async { 103 | when(() => response.statusCode).thenReturn(200); 104 | when(() => response.body).thenReturn('bananas'); 105 | when(() => client.get(Uri.parse(serverToPing))).thenAnswer( 106 | (invocation) => Future.delayed( 107 | Duration(seconds: 10), 108 | ), 109 | ); 110 | final utils = ConnectivityUtils.test( 111 | connectivity: connectivity, httpClient: client); 112 | utils.serverToPing = serverToPing; 113 | final result = await utils.isPhoneConnected(); 114 | expect(result, isFalse); 115 | }); 116 | 117 | test('if verify response callback returns true, we verify response', 118 | () async { 119 | final utils = ConnectivityUtils.test( 120 | connectivity: connectivity, httpClient: client); 121 | utils.serverToPing = serverToPing; 122 | utils.verifyResponseCallback = (_) => true; 123 | when(() => client.get(Uri.parse(serverToPing))).thenAnswer( 124 | (invocation) => Future.value( 125 | response, 126 | ), 127 | ); 128 | when(() => response.statusCode).thenReturn(200); 129 | when(() => response.body).thenReturn('bananas'); 130 | final result = await utils.isPhoneConnected(); 131 | expect(result, isTrue); 132 | }); 133 | 134 | test( 135 | 'if verify response callback returns false, we don\'t verify response', 136 | () async { 137 | final utils = ConnectivityUtils.test( 138 | connectivity: connectivity, httpClient: client); 139 | utils.serverToPing = serverToPing; 140 | utils.verifyResponseCallback = (_) => false; 141 | when(() => client.get(Uri.parse(serverToPing))).thenAnswer( 142 | (invocation) => Future.value( 143 | response, 144 | ), 145 | ); 146 | when(() => response.statusCode).thenReturn(200); 147 | when(() => response.body).thenReturn('bananas'); 148 | final result = await utils.isPhoneConnected(); 149 | expect(result, isFalse); 150 | }); 151 | 152 | test('in onVerifyResponse we output the correct response', () async { 153 | final utils = ConnectivityUtils.test( 154 | connectivity: connectivity, httpClient: client); 155 | const body = 'bananas'; 156 | utils.serverToPing = serverToPing; 157 | String? result; 158 | utils.verifyResponseCallback = (response) { 159 | result = response; 160 | return true; 161 | }; 162 | when(() => client.get(Uri.parse(serverToPing))).thenAnswer( 163 | (invocation) => Future.value( 164 | response, 165 | ), 166 | ); 167 | when(() => response.statusCode).thenReturn(200); 168 | when(() => response.body).thenReturn(body); 169 | await utils.isPhoneConnected(); 170 | expect(result, body); 171 | }); 172 | }); 173 | 174 | group('GetConnectivityStatus', () { 175 | test('when initializing, we will get the first status', () async { 176 | when(() => response.statusCode).thenReturn(200); 177 | when(() => response.body).thenReturn('bananas'); 178 | when(() => client.get(Uri.parse(serverToPing))).thenAnswer( 179 | (invocation) => Future.value( 180 | response, 181 | ), 182 | ); 183 | final utils = ConnectivityUtils.test( 184 | connectivity: connectivity, httpClient: client); 185 | expectLater(utils.isPhoneConnectedStream, emitsDone); 186 | await utils.dispose(); 187 | }); 188 | 189 | test('streams outputs isPhoneConnected status', () async { 190 | when(() => response.statusCode).thenReturn(200); 191 | when(() => response.body).thenReturn('bananas'); 192 | when(() => client.get(Uri.parse(serverToPing))).thenAnswer( 193 | (invocation) => Future.value( 194 | response, 195 | ), 196 | ); 197 | final utils = ConnectivityUtils.test( 198 | connectivity: connectivity, httpClient: client); 199 | utils.serverToPing = serverToPing; 200 | utils.getConnectivityStatusSink.add(Event()); 201 | utils.debounceDuration = duration; 202 | expectLater( 203 | utils.isPhoneConnectedStream, 204 | emitsInOrder( 205 | [isTrue], 206 | ), 207 | ); 208 | await Future.delayed(Duration(seconds: 1)); 209 | await utils.dispose(); 210 | }); 211 | 212 | test('only emits distinct values', () async { 213 | when(() => response.statusCode).thenReturn(200); 214 | when(() => response.body).thenReturn('bananas'); 215 | when(() => client.get(Uri.parse(serverToPing))).thenAnswer( 216 | (invocation) => Future.value( 217 | response, 218 | ), 219 | ); 220 | final utils = ConnectivityUtils.test( 221 | connectivity: connectivity, httpClient: client); 222 | utils.serverToPing = serverToPing; 223 | utils.debounceDuration = duration; 224 | expectLater(utils.isPhoneConnectedStream, emitsInOrder([isTrue])); 225 | utils.getConnectivityStatusSink.add(Event()); 226 | await Future.delayed(duration); 227 | await utils.dispose(); 228 | }); 229 | 230 | test('if server response changes, we emit false', () async { 231 | when(() => response.statusCode).thenReturn(200); 232 | when(() => response.body).thenReturn('bananas'); 233 | when(() => client.get(Uri.parse(serverToPing))).thenAnswer( 234 | (invocation) => Future.value( 235 | response, 236 | ), 237 | ); 238 | final utils = ConnectivityUtils.test( 239 | connectivity: connectivity, httpClient: client); 240 | utils.serverToPing = serverToPing; 241 | utils.debounceDuration = duration; 242 | expectLater( 243 | utils.isPhoneConnectedStream, emitsInOrder([isTrue, isFalse])); 244 | utils.getConnectivityStatusSink.add(Event()); 245 | await Future.delayed(Duration(seconds: 1)); 246 | const newServerToPing = 'https://my.app'; 247 | when(() => response.statusCode).thenReturn(500); 248 | when(() => response.body).thenReturn('bananas'); 249 | when(() => client.get(Uri.parse(newServerToPing))).thenAnswer( 250 | (invocation) => Future.value( 251 | response, 252 | ), 253 | ); 254 | utils.serverToPing = newServerToPing; 255 | 256 | await Future.delayed(Duration(seconds: 1)); 257 | 258 | utils.getConnectivityStatusSink.add(Event()); 259 | 260 | await utils.dispose(); 261 | }); 262 | 263 | test('if retries is set to 0, the server is pinged 1 time only on error', 264 | () async { 265 | when(() => client.get(Uri.parse(serverToPing))).thenAnswer( 266 | (invocation) => Future.value( 267 | response, 268 | ), 269 | ); 270 | when(() => response.statusCode).thenReturn(500); 271 | when(() => response.body).thenReturn('bananas'); 272 | ConnectivityUtils.test( 273 | connectivity: connectivity, 274 | httpClient: client, 275 | retries: 0, 276 | serverToPing: serverToPing, 277 | ); 278 | await Future.delayed(Duration(milliseconds: 500)); 279 | verify(() => client.get(Uri.parse(serverToPing))).called(1); 280 | }); 281 | 282 | test( 283 | 'if retries is set to 4, the server is called 4 times before retrieving false', 284 | () async { 285 | when(() => client.get(Uri.parse(serverToPing))).thenAnswer( 286 | (invocation) => Future.value( 287 | response, 288 | ), 289 | ); 290 | when(() => response.statusCode).thenReturn(500); 291 | when(() => response.body).thenReturn('bananas'); 292 | ConnectivityUtils.test( 293 | connectivity: connectivity, 294 | httpClient: client, 295 | serverToPing: serverToPing, 296 | retries: 4, 297 | ); 298 | await Future.delayed(Duration(seconds: 5)); 299 | verify(() => client.get(Uri.parse(serverToPing))).called(4); 300 | }); 301 | 302 | test( 303 | 'if minSuccessCalls is set to 1, the server is called 1 time before retrieving true', 304 | () async { 305 | when(() => client.get(Uri.parse(serverToPing))).thenAnswer( 306 | (invocation) => Future.value( 307 | response, 308 | ), 309 | ); 310 | when(() => response.statusCode).thenReturn(200); 311 | when(() => response.body).thenReturn('bananas'); 312 | ConnectivityUtils.test( 313 | connectivity: connectivity, 314 | httpClient: client, 315 | serverToPing: serverToPing, 316 | minSuccessCalls: 1, 317 | ); 318 | await Future.delayed(Duration(milliseconds: 500)); 319 | verify(() => client.get(Uri.parse(serverToPing))).called(1); 320 | }); 321 | 322 | test( 323 | 'if minSuccessCalls is set to 4, the server is called 4 time before retrieving true', 324 | () async { 325 | when(() => client.get(Uri.parse(serverToPing))).thenAnswer( 326 | (invocation) => Future.value( 327 | response, 328 | ), 329 | ); 330 | when(() => response.statusCode).thenReturn(200); 331 | when(() => response.body).thenReturn('bananas'); 332 | ConnectivityUtils.test( 333 | connectivity: connectivity, 334 | httpClient: client, 335 | serverToPing: serverToPing, 336 | minSuccessCalls: 4, 337 | ); 338 | await Future.delayed(Duration(seconds: 5)); 339 | verify(() => client.get(Uri.parse(serverToPing))).called(4); 340 | }); 341 | }); 342 | }); 343 | } 344 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 54; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 12 | 4140510F022140A07E259413 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8305FA850F0AC5739D367868 /* Pods_Runner.framework */; }; 13 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 14 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 15 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 16 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXCopyFilesBuildPhase section */ 20 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 21 | isa = PBXCopyFilesBuildPhase; 22 | buildActionMask = 2147483647; 23 | dstPath = ""; 24 | dstSubfolderSpec = 10; 25 | files = ( 26 | ); 27 | name = "Embed Frameworks"; 28 | runOnlyForDeploymentPostprocessing = 0; 29 | }; 30 | /* End PBXCopyFilesBuildPhase section */ 31 | 32 | /* Begin PBXFileReference section */ 33 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 34 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 35 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 36 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 37 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 38 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 39 | 8305FA850F0AC5739D367868 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 40 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 41 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 42 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 43 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 44 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 45 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 46 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 47 | E62D5EF7D45CCC6E84CA8D3C /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 48 | ECD4BD564AAA5895540249CC /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 49 | F1CC03065E563DAE3D63762B /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 50 | /* End PBXFileReference section */ 51 | 52 | /* Begin PBXFrameworksBuildPhase section */ 53 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 54 | isa = PBXFrameworksBuildPhase; 55 | buildActionMask = 2147483647; 56 | files = ( 57 | 4140510F022140A07E259413 /* Pods_Runner.framework in Frameworks */, 58 | ); 59 | runOnlyForDeploymentPostprocessing = 0; 60 | }; 61 | /* End PBXFrameworksBuildPhase section */ 62 | 63 | /* Begin PBXGroup section */ 64 | 49E00FB40DC819C95883F857 /* Frameworks */ = { 65 | isa = PBXGroup; 66 | children = ( 67 | 8305FA850F0AC5739D367868 /* Pods_Runner.framework */, 68 | ); 69 | name = Frameworks; 70 | sourceTree = ""; 71 | }; 72 | 9740EEB11CF90186004384FC /* Flutter */ = { 73 | isa = PBXGroup; 74 | children = ( 75 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 76 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 77 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 78 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 79 | ); 80 | name = Flutter; 81 | sourceTree = ""; 82 | }; 83 | 97C146E51CF9000F007C117D = { 84 | isa = PBXGroup; 85 | children = ( 86 | 9740EEB11CF90186004384FC /* Flutter */, 87 | 97C146F01CF9000F007C117D /* Runner */, 88 | 97C146EF1CF9000F007C117D /* Products */, 89 | F3A5226A300FD000F4D4BD27 /* Pods */, 90 | 49E00FB40DC819C95883F857 /* Frameworks */, 91 | ); 92 | sourceTree = ""; 93 | }; 94 | 97C146EF1CF9000F007C117D /* Products */ = { 95 | isa = PBXGroup; 96 | children = ( 97 | 97C146EE1CF9000F007C117D /* Runner.app */, 98 | ); 99 | name = Products; 100 | sourceTree = ""; 101 | }; 102 | 97C146F01CF9000F007C117D /* Runner */ = { 103 | isa = PBXGroup; 104 | children = ( 105 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 106 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 107 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 108 | 97C147021CF9000F007C117D /* Info.plist */, 109 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 110 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 111 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 112 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, 113 | ); 114 | path = Runner; 115 | sourceTree = ""; 116 | }; 117 | F3A5226A300FD000F4D4BD27 /* Pods */ = { 118 | isa = PBXGroup; 119 | children = ( 120 | F1CC03065E563DAE3D63762B /* Pods-Runner.debug.xcconfig */, 121 | ECD4BD564AAA5895540249CC /* Pods-Runner.release.xcconfig */, 122 | E62D5EF7D45CCC6E84CA8D3C /* Pods-Runner.profile.xcconfig */, 123 | ); 124 | name = Pods; 125 | path = Pods; 126 | sourceTree = ""; 127 | }; 128 | /* End PBXGroup section */ 129 | 130 | /* Begin PBXNativeTarget section */ 131 | 97C146ED1CF9000F007C117D /* Runner */ = { 132 | isa = PBXNativeTarget; 133 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 134 | buildPhases = ( 135 | 7E0FD3C4ADDC1347E0415B32 /* [CP] Check Pods Manifest.lock */, 136 | 9740EEB61CF901F6004384FC /* Run Script */, 137 | 97C146EA1CF9000F007C117D /* Sources */, 138 | 97C146EB1CF9000F007C117D /* Frameworks */, 139 | 97C146EC1CF9000F007C117D /* Resources */, 140 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 141 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 142 | 1F7BD2287DD8B6D4E358975D /* [CP] Embed Pods Frameworks */, 143 | ); 144 | buildRules = ( 145 | ); 146 | dependencies = ( 147 | ); 148 | name = Runner; 149 | productName = Runner; 150 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 151 | productType = "com.apple.product-type.application"; 152 | }; 153 | /* End PBXNativeTarget section */ 154 | 155 | /* Begin PBXProject section */ 156 | 97C146E61CF9000F007C117D /* Project object */ = { 157 | isa = PBXProject; 158 | attributes = { 159 | LastUpgradeCheck = 1510; 160 | ORGANIZATIONNAME = ""; 161 | TargetAttributes = { 162 | 97C146ED1CF9000F007C117D = { 163 | CreatedOnToolsVersion = 7.3.1; 164 | LastSwiftMigration = 1100; 165 | }; 166 | }; 167 | }; 168 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 169 | compatibilityVersion = "Xcode 9.3"; 170 | developmentRegion = en; 171 | hasScannedForEncodings = 0; 172 | knownRegions = ( 173 | en, 174 | Base, 175 | ); 176 | mainGroup = 97C146E51CF9000F007C117D; 177 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 178 | projectDirPath = ""; 179 | projectRoot = ""; 180 | targets = ( 181 | 97C146ED1CF9000F007C117D /* Runner */, 182 | ); 183 | }; 184 | /* End PBXProject section */ 185 | 186 | /* Begin PBXResourcesBuildPhase section */ 187 | 97C146EC1CF9000F007C117D /* Resources */ = { 188 | isa = PBXResourcesBuildPhase; 189 | buildActionMask = 2147483647; 190 | files = ( 191 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 192 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 193 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 194 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 195 | ); 196 | runOnlyForDeploymentPostprocessing = 0; 197 | }; 198 | /* End PBXResourcesBuildPhase section */ 199 | 200 | /* Begin PBXShellScriptBuildPhase section */ 201 | 1F7BD2287DD8B6D4E358975D /* [CP] Embed Pods Frameworks */ = { 202 | isa = PBXShellScriptBuildPhase; 203 | buildActionMask = 2147483647; 204 | files = ( 205 | ); 206 | inputFileListPaths = ( 207 | "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", 208 | ); 209 | name = "[CP] Embed Pods Frameworks"; 210 | outputFileListPaths = ( 211 | "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", 212 | ); 213 | runOnlyForDeploymentPostprocessing = 0; 214 | shellPath = /bin/sh; 215 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; 216 | showEnvVarsInLog = 0; 217 | }; 218 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 219 | isa = PBXShellScriptBuildPhase; 220 | alwaysOutOfDate = 1; 221 | buildActionMask = 2147483647; 222 | files = ( 223 | ); 224 | inputPaths = ( 225 | "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}", 226 | ); 227 | name = "Thin Binary"; 228 | outputPaths = ( 229 | ); 230 | runOnlyForDeploymentPostprocessing = 0; 231 | shellPath = /bin/sh; 232 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; 233 | }; 234 | 7E0FD3C4ADDC1347E0415B32 /* [CP] Check Pods Manifest.lock */ = { 235 | isa = PBXShellScriptBuildPhase; 236 | buildActionMask = 2147483647; 237 | files = ( 238 | ); 239 | inputFileListPaths = ( 240 | ); 241 | inputPaths = ( 242 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 243 | "${PODS_ROOT}/Manifest.lock", 244 | ); 245 | name = "[CP] Check Pods Manifest.lock"; 246 | outputFileListPaths = ( 247 | ); 248 | outputPaths = ( 249 | "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", 250 | ); 251 | runOnlyForDeploymentPostprocessing = 0; 252 | shellPath = /bin/sh; 253 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 254 | showEnvVarsInLog = 0; 255 | }; 256 | 9740EEB61CF901F6004384FC /* Run Script */ = { 257 | isa = PBXShellScriptBuildPhase; 258 | alwaysOutOfDate = 1; 259 | buildActionMask = 2147483647; 260 | files = ( 261 | ); 262 | inputPaths = ( 263 | ); 264 | name = "Run Script"; 265 | outputPaths = ( 266 | ); 267 | runOnlyForDeploymentPostprocessing = 0; 268 | shellPath = /bin/sh; 269 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 270 | }; 271 | /* End PBXShellScriptBuildPhase section */ 272 | 273 | /* Begin PBXSourcesBuildPhase section */ 274 | 97C146EA1CF9000F007C117D /* Sources */ = { 275 | isa = PBXSourcesBuildPhase; 276 | buildActionMask = 2147483647; 277 | files = ( 278 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 279 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 280 | ); 281 | runOnlyForDeploymentPostprocessing = 0; 282 | }; 283 | /* End PBXSourcesBuildPhase section */ 284 | 285 | /* Begin PBXVariantGroup section */ 286 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 287 | isa = PBXVariantGroup; 288 | children = ( 289 | 97C146FB1CF9000F007C117D /* Base */, 290 | ); 291 | name = Main.storyboard; 292 | sourceTree = ""; 293 | }; 294 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 295 | isa = PBXVariantGroup; 296 | children = ( 297 | 97C147001CF9000F007C117D /* Base */, 298 | ); 299 | name = LaunchScreen.storyboard; 300 | sourceTree = ""; 301 | }; 302 | /* End PBXVariantGroup section */ 303 | 304 | /* Begin XCBuildConfiguration section */ 305 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 306 | isa = XCBuildConfiguration; 307 | buildSettings = { 308 | ALWAYS_SEARCH_USER_PATHS = NO; 309 | CLANG_ANALYZER_NONNULL = YES; 310 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 311 | CLANG_CXX_LIBRARY = "libc++"; 312 | CLANG_ENABLE_MODULES = YES; 313 | CLANG_ENABLE_OBJC_ARC = YES; 314 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 315 | CLANG_WARN_BOOL_CONVERSION = YES; 316 | CLANG_WARN_COMMA = YES; 317 | CLANG_WARN_CONSTANT_CONVERSION = YES; 318 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 319 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 320 | CLANG_WARN_EMPTY_BODY = YES; 321 | CLANG_WARN_ENUM_CONVERSION = YES; 322 | CLANG_WARN_INFINITE_RECURSION = YES; 323 | CLANG_WARN_INT_CONVERSION = YES; 324 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 325 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 326 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 327 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 328 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 329 | CLANG_WARN_STRICT_PROTOTYPES = YES; 330 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 331 | CLANG_WARN_UNREACHABLE_CODE = YES; 332 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 333 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 334 | COPY_PHASE_STRIP = NO; 335 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 336 | ENABLE_NS_ASSERTIONS = NO; 337 | ENABLE_STRICT_OBJC_MSGSEND = YES; 338 | GCC_C_LANGUAGE_STANDARD = gnu99; 339 | GCC_NO_COMMON_BLOCKS = YES; 340 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 341 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 342 | GCC_WARN_UNDECLARED_SELECTOR = YES; 343 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 344 | GCC_WARN_UNUSED_FUNCTION = YES; 345 | GCC_WARN_UNUSED_VARIABLE = YES; 346 | IPHONEOS_DEPLOYMENT_TARGET = 12.0; 347 | MTL_ENABLE_DEBUG_INFO = NO; 348 | SDKROOT = iphoneos; 349 | SUPPORTED_PLATFORMS = iphoneos; 350 | TARGETED_DEVICE_FAMILY = "1,2"; 351 | VALIDATE_PRODUCT = YES; 352 | }; 353 | name = Profile; 354 | }; 355 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 356 | isa = XCBuildConfiguration; 357 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 358 | buildSettings = { 359 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 360 | CLANG_ENABLE_MODULES = YES; 361 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 362 | DEVELOPMENT_TEAM = 65W87DD398; 363 | ENABLE_BITCODE = NO; 364 | INFOPLIST_FILE = Runner/Info.plist; 365 | LD_RUNPATH_SEARCH_PATHS = ( 366 | "$(inherited)", 367 | "@executable_path/Frameworks", 368 | ); 369 | PRODUCT_BUNDLE_IDENTIFIER = com.vanethos.example.example; 370 | PRODUCT_NAME = "$(TARGET_NAME)"; 371 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 372 | SWIFT_VERSION = 5.0; 373 | VERSIONING_SYSTEM = "apple-generic"; 374 | }; 375 | name = Profile; 376 | }; 377 | 97C147031CF9000F007C117D /* Debug */ = { 378 | isa = XCBuildConfiguration; 379 | buildSettings = { 380 | ALWAYS_SEARCH_USER_PATHS = NO; 381 | CLANG_ANALYZER_NONNULL = YES; 382 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 383 | CLANG_CXX_LIBRARY = "libc++"; 384 | CLANG_ENABLE_MODULES = YES; 385 | CLANG_ENABLE_OBJC_ARC = YES; 386 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 387 | CLANG_WARN_BOOL_CONVERSION = YES; 388 | CLANG_WARN_COMMA = YES; 389 | CLANG_WARN_CONSTANT_CONVERSION = YES; 390 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 391 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 392 | CLANG_WARN_EMPTY_BODY = YES; 393 | CLANG_WARN_ENUM_CONVERSION = YES; 394 | CLANG_WARN_INFINITE_RECURSION = YES; 395 | CLANG_WARN_INT_CONVERSION = YES; 396 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 397 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 398 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 399 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 400 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 401 | CLANG_WARN_STRICT_PROTOTYPES = YES; 402 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 403 | CLANG_WARN_UNREACHABLE_CODE = YES; 404 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 405 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 406 | COPY_PHASE_STRIP = NO; 407 | DEBUG_INFORMATION_FORMAT = dwarf; 408 | ENABLE_STRICT_OBJC_MSGSEND = YES; 409 | ENABLE_TESTABILITY = YES; 410 | GCC_C_LANGUAGE_STANDARD = gnu99; 411 | GCC_DYNAMIC_NO_PIC = NO; 412 | GCC_NO_COMMON_BLOCKS = YES; 413 | GCC_OPTIMIZATION_LEVEL = 0; 414 | GCC_PREPROCESSOR_DEFINITIONS = ( 415 | "DEBUG=1", 416 | "$(inherited)", 417 | ); 418 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 419 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 420 | GCC_WARN_UNDECLARED_SELECTOR = YES; 421 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 422 | GCC_WARN_UNUSED_FUNCTION = YES; 423 | GCC_WARN_UNUSED_VARIABLE = YES; 424 | IPHONEOS_DEPLOYMENT_TARGET = 12.0; 425 | MTL_ENABLE_DEBUG_INFO = YES; 426 | ONLY_ACTIVE_ARCH = YES; 427 | SDKROOT = iphoneos; 428 | TARGETED_DEVICE_FAMILY = "1,2"; 429 | }; 430 | name = Debug; 431 | }; 432 | 97C147041CF9000F007C117D /* Release */ = { 433 | isa = XCBuildConfiguration; 434 | buildSettings = { 435 | ALWAYS_SEARCH_USER_PATHS = NO; 436 | CLANG_ANALYZER_NONNULL = YES; 437 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 438 | CLANG_CXX_LIBRARY = "libc++"; 439 | CLANG_ENABLE_MODULES = YES; 440 | CLANG_ENABLE_OBJC_ARC = YES; 441 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 442 | CLANG_WARN_BOOL_CONVERSION = YES; 443 | CLANG_WARN_COMMA = YES; 444 | CLANG_WARN_CONSTANT_CONVERSION = YES; 445 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 446 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 447 | CLANG_WARN_EMPTY_BODY = YES; 448 | CLANG_WARN_ENUM_CONVERSION = YES; 449 | CLANG_WARN_INFINITE_RECURSION = YES; 450 | CLANG_WARN_INT_CONVERSION = YES; 451 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 452 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 453 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 454 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 455 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 456 | CLANG_WARN_STRICT_PROTOTYPES = YES; 457 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 458 | CLANG_WARN_UNREACHABLE_CODE = YES; 459 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 460 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 461 | COPY_PHASE_STRIP = NO; 462 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 463 | ENABLE_NS_ASSERTIONS = NO; 464 | ENABLE_STRICT_OBJC_MSGSEND = YES; 465 | GCC_C_LANGUAGE_STANDARD = gnu99; 466 | GCC_NO_COMMON_BLOCKS = YES; 467 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 468 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 469 | GCC_WARN_UNDECLARED_SELECTOR = YES; 470 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 471 | GCC_WARN_UNUSED_FUNCTION = YES; 472 | GCC_WARN_UNUSED_VARIABLE = YES; 473 | IPHONEOS_DEPLOYMENT_TARGET = 12.0; 474 | MTL_ENABLE_DEBUG_INFO = NO; 475 | SDKROOT = iphoneos; 476 | SUPPORTED_PLATFORMS = iphoneos; 477 | SWIFT_COMPILATION_MODE = wholemodule; 478 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 479 | TARGETED_DEVICE_FAMILY = "1,2"; 480 | VALIDATE_PRODUCT = YES; 481 | }; 482 | name = Release; 483 | }; 484 | 97C147061CF9000F007C117D /* Debug */ = { 485 | isa = XCBuildConfiguration; 486 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 487 | buildSettings = { 488 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 489 | CLANG_ENABLE_MODULES = YES; 490 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 491 | DEVELOPMENT_TEAM = 65W87DD398; 492 | ENABLE_BITCODE = NO; 493 | INFOPLIST_FILE = Runner/Info.plist; 494 | LD_RUNPATH_SEARCH_PATHS = ( 495 | "$(inherited)", 496 | "@executable_path/Frameworks", 497 | ); 498 | PRODUCT_BUNDLE_IDENTIFIER = com.vanethos.example.example; 499 | PRODUCT_NAME = "$(TARGET_NAME)"; 500 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 501 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 502 | SWIFT_VERSION = 5.0; 503 | VERSIONING_SYSTEM = "apple-generic"; 504 | }; 505 | name = Debug; 506 | }; 507 | 97C147071CF9000F007C117D /* Release */ = { 508 | isa = XCBuildConfiguration; 509 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 510 | buildSettings = { 511 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 512 | CLANG_ENABLE_MODULES = YES; 513 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 514 | DEVELOPMENT_TEAM = 65W87DD398; 515 | ENABLE_BITCODE = NO; 516 | INFOPLIST_FILE = Runner/Info.plist; 517 | LD_RUNPATH_SEARCH_PATHS = ( 518 | "$(inherited)", 519 | "@executable_path/Frameworks", 520 | ); 521 | PRODUCT_BUNDLE_IDENTIFIER = com.vanethos.example.example; 522 | PRODUCT_NAME = "$(TARGET_NAME)"; 523 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 524 | SWIFT_VERSION = 5.0; 525 | VERSIONING_SYSTEM = "apple-generic"; 526 | }; 527 | name = Release; 528 | }; 529 | /* End XCBuildConfiguration section */ 530 | 531 | /* Begin XCConfigurationList section */ 532 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 533 | isa = XCConfigurationList; 534 | buildConfigurations = ( 535 | 97C147031CF9000F007C117D /* Debug */, 536 | 97C147041CF9000F007C117D /* Release */, 537 | 249021D3217E4FDB00AE95B9 /* Profile */, 538 | ); 539 | defaultConfigurationIsVisible = 0; 540 | defaultConfigurationName = Release; 541 | }; 542 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 543 | isa = XCConfigurationList; 544 | buildConfigurations = ( 545 | 97C147061CF9000F007C117D /* Debug */, 546 | 97C147071CF9000F007C117D /* Release */, 547 | 249021D4217E4FDB00AE95B9 /* Profile */, 548 | ); 549 | defaultConfigurationIsVisible = 0; 550 | defaultConfigurationName = Release; 551 | }; 552 | /* End XCConfigurationList section */ 553 | }; 554 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 555 | } 556 | --------------------------------------------------------------------------------