├── .gitignore ├── .metadata ├── LICENSE.md ├── README.md ├── analysis_options.yaml ├── android ├── .gitignore ├── app │ ├── build.gradle │ └── src │ │ ├── debug │ │ └── AndroidManifest.xml │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── kotlin │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── flutter_dio_example │ │ │ │ └── MainActivity.kt │ │ └── res │ │ │ ├── drawable-v21 │ │ │ └── launch_background.xml │ │ │ ├── drawable │ │ │ └── launch_background.xml │ │ │ ├── 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 │ │ │ ├── values-night │ │ │ └── styles.xml │ │ │ └── values │ │ │ └── styles.xml │ │ └── profile │ │ └── AndroidManifest.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties └── settings.gradle ├── ios ├── .gitignore ├── Flutter │ ├── AppFrameworkInfo.plist │ ├── Debug.xcconfig │ └── Release.xcconfig ├── Podfile ├── Podfile.lock ├── Runner.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ └── WorkspaceSettings.xcsettings │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ ├── IDEWorkspaceChecks.plist │ │ └── WorkspaceSettings.xcsettings └── Runner │ ├── AppDelegate.swift │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── Icon-App-1024x1024@1x.png │ │ ├── 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-83.5x83.5@2x.png │ └── LaunchImage.imageset │ │ ├── Contents.json │ │ ├── LaunchImage.png │ │ ├── LaunchImage@2x.png │ │ ├── LaunchImage@3x.png │ │ └── README.md │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Info.plist │ └── Runner-Bridging-Header.h ├── lib ├── extensions │ ├── extensions.dart │ └── text_extension.dart ├── main.dart ├── models │ ├── models.dart │ ├── post.dart │ ├── user.dart │ └── user.g.dart ├── network │ ├── api_service.dart │ ├── caller.dart │ ├── dio_exception.dart │ ├── dio_service.dart │ ├── endpoints.dart │ ├── interceptors │ │ ├── authorization_interceptor.dart │ │ ├── dio_cache_interceptor.dart │ │ ├── interceptors.dart │ │ └── logger_interceptor.dart │ └── network.dart ├── view │ └── home_screen.dart └── widgets │ ├── output_error.dart │ ├── output_panel.dart │ ├── output_success.dart │ └── widgets.dart ├── pubspec.lock ├── pubspec.yaml ├── test └── widget_test.dart └── web ├── favicon.png ├── icons ├── Icon-192.png ├── Icon-512.png ├── Icon-maskable-192.png └── Icon-maskable-512.png ├── index.html └── manifest.json /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | migrate_working_dir/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # The .vscode folder contains launch configuration and tasks you configure in 20 | # VS Code which you may wish to be included in version control, so this line 21 | # is commented out by default. 22 | #.vscode/ 23 | 24 | # Flutter/Dart/Pub related 25 | **/doc/api/ 26 | **/ios/Flutter/.last_build_id 27 | .dart_tool/ 28 | .flutter-plugins 29 | .flutter-plugins-dependencies 30 | .packages 31 | .pub-cache/ 32 | .pub/ 33 | /build/ 34 | 35 | # Web related 36 | lib/generated_plugin_registrant.dart 37 | 38 | # Symbolication related 39 | app.*.symbols 40 | 41 | # Obfuscation related 42 | app.*.map.json 43 | 44 | # Android Studio will place build artifacts here 45 | /android/app/debug 46 | /android/app/profile 47 | /android/app/release 48 | -------------------------------------------------------------------------------- /.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: ee4e09cce01d6f2d7f4baebd247fde02e5008851 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: ee4e09cce01d6f2d7f4baebd247fde02e5008851 17 | base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 18 | - platform: android 19 | create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 20 | base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 21 | - platform: ios 22 | create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 23 | base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 24 | - platform: web 25 | create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 26 | base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 27 | 28 | # User provided section 29 | 30 | # List of Local paths (relative to this file) that should be 31 | # ignored by the migrate tool. 32 | # 33 | # Files that are not part of the templates will be ignored by default. 34 | unmanaged_files: 35 | - 'lib/main.dart' 36 | - 'ios/Runner.xcodeproj/project.pbxproj' 37 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Sandip Pramanik 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 |

Flutter Dio Cache Interceptor Example

3 |
4 | 5 |

Overview

6 | 7 |

Caching is a crucial process for storing API responses on a user's device to reduce network requests and improve performance in Flutter apps. This example demonstrates how to implement caching for API requests using the Dio HTTP client and the Dio Cache Interceptor.

8 | 9 |

Key Components

10 | 11 | 16 | 17 |

Implementation Steps

18 | 19 |

1. Add Dependencies

20 | 21 |

In your `pubspec.yaml` file, add the required packages:

22 | 23 |
 24 | 
 25 | dependencies:
 26 |   dio: ^4.0.6
 27 |   dio_cache_interceptor: ^3.3.0
 28 |   dio_cache_interceptor_hive_store: ^3.2.0
 29 |   hive: ^2.0.5
 30 | 
 31 | 
32 | 33 |

2. Set Up Cache Directory

34 | 35 |

Get the temporary directory on the device where cached data will be stored. It's recommended to use the temporary directory provided by Flutter:

36 | 37 |
 38 | 
 39 | var cacheDir = await getTemporaryDirectory();
 40 | 
 41 | 
42 | 43 |

3. Build Cache Store

44 | 45 |

Create a cacheStore object, specifying the cache directory path and a unique hiveBoxName for your app:

46 | 47 |
 48 | 
 49 | var cacheStore = HiveCacheStore(
 50 |   cacheDir.path,
 51 |   hiveBoxName: "your_app_name",
 52 | );
 53 | 
 54 | 
55 | 56 |

4. Define Cache Options

57 | 58 |

Customize cache options to control caching behavior, such as cache policy, priority, maxStale duration, key building, and more:

59 | 60 |
 61 | 
 62 | var customCacheOptions = CacheOptions(
 63 |   store: cacheStore,
 64 |   policy: CachePolicy.forceCache,
 65 |   priority: CachePriority.high,
 66 |   maxStale: const Duration(minutes: 5),
 67 |   hitCacheOnErrorExcept: [401, 404],
 68 |   keyBuilder: (request) {
 69 |     return request.uri.toString();
 70 |   },
 71 |   allowPostMethod: false,
 72 | );
 73 | 
 74 | 
75 | 76 |

5. Build Dio with Cache Interceptor

77 | 78 |

Create a Dio instance and add the cache interceptor with your custom cache options:

79 | 80 |
 81 | 
 82 | var customDio = Dio()
 83 |   ..interceptors.add(DioCacheInterceptor(options: customCacheOptions));
 84 | 
 85 | 
86 | 87 |

Best Practices for Network Calling and Error Handling

88 | 89 |

Follow these best practices when using Dio for network requests:

90 | 91 | 97 | 98 |

Usage

99 | 100 |

Now, all your GET requests made using the customDio object will be cached in the user's device storage temporary directory while following best practices for network calling and error handling.

101 | 102 |

Feel free to explore and customize this example for your Flutter app's caching needs.

103 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 33 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.example.flutter_dio_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 | -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 15 | 19 | 23 | 24 | 25 | 26 | 27 | 28 | 30 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /android/app/src/main/kotlin/com/example/flutter_dio_example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.flutter_dio_example 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shahanajparvin/flutter-dio-cache-interceptor_example/9d27e47c5f4f0c3bd6c603bf4ec9c02375c617af/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shahanajparvin/flutter-dio-cache-interceptor_example/9d27e47c5f4f0c3bd6c603bf4ec9c02375c617af/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shahanajparvin/flutter-dio-cache-interceptor_example/9d27e47c5f4f0c3bd6c603bf4ec9c02375c617af/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shahanajparvin/flutter-dio-cache-interceptor_example/9d27e47c5f4f0c3bd6c603bf4ec9c02375c617af/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shahanajparvin/flutter-dio-cache-interceptor_example/9d27e47c5f4f0c3bd6c603bf4ec9c02375c617af/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /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 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip 7 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | 11.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '11.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 | -------------------------------------------------------------------------------- /ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Flutter (1.0.0) 3 | - path_provider_foundation (0.0.1): 4 | - Flutter 5 | - FlutterMacOS 6 | 7 | DEPENDENCIES: 8 | - Flutter (from `Flutter`) 9 | - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/ios`) 10 | 11 | EXTERNAL SOURCES: 12 | Flutter: 13 | :path: Flutter 14 | path_provider_foundation: 15 | :path: ".symlinks/plugins/path_provider_foundation/ios" 16 | 17 | SPEC CHECKSUMS: 18 | Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 19 | path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943 20 | 21 | PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3 22 | 23 | COCOAPODS: 1.12.1 24 | -------------------------------------------------------------------------------- /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 | 29AED51BA990BC000800B405 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC73E221E6E33698B73B9874 /* Pods_Runner.framework */; }; 12 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 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 | 127791481E073B6738D586C7 /* 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 = ""; }; 34 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 35 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 36 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 37 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 38 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 39 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 40 | 7F737BB7D1C7220CF94513A2 /* 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 = ""; }; 41 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 42 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 43 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 44 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 45 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 46 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 47 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 48 | BC73E221E6E33698B73B9874 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 49 | F77B4BBEC172AD019E23950D /* 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 | 29AED51BA990BC000800B405 /* Pods_Runner.framework in Frameworks */, 58 | ); 59 | runOnlyForDeploymentPostprocessing = 0; 60 | }; 61 | /* End PBXFrameworksBuildPhase section */ 62 | 63 | /* Begin PBXGroup section */ 64 | 4E7765D14514DF90B76E6DF2 /* Frameworks */ = { 65 | isa = PBXGroup; 66 | children = ( 67 | BC73E221E6E33698B73B9874 /* Pods_Runner.framework */, 68 | ); 69 | name = Frameworks; 70 | sourceTree = ""; 71 | }; 72 | 66E3AFCF1FB860DD2BFFC40A /* Pods */ = { 73 | isa = PBXGroup; 74 | children = ( 75 | F77B4BBEC172AD019E23950D /* Pods-Runner.debug.xcconfig */, 76 | 7F737BB7D1C7220CF94513A2 /* Pods-Runner.release.xcconfig */, 77 | 127791481E073B6738D586C7 /* Pods-Runner.profile.xcconfig */, 78 | ); 79 | path = Pods; 80 | sourceTree = ""; 81 | }; 82 | 9740EEB11CF90186004384FC /* Flutter */ = { 83 | isa = PBXGroup; 84 | children = ( 85 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 86 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 87 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 88 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 89 | ); 90 | name = Flutter; 91 | sourceTree = ""; 92 | }; 93 | 97C146E51CF9000F007C117D = { 94 | isa = PBXGroup; 95 | children = ( 96 | 9740EEB11CF90186004384FC /* Flutter */, 97 | 97C146F01CF9000F007C117D /* Runner */, 98 | 97C146EF1CF9000F007C117D /* Products */, 99 | 66E3AFCF1FB860DD2BFFC40A /* Pods */, 100 | 4E7765D14514DF90B76E6DF2 /* Frameworks */, 101 | ); 102 | sourceTree = ""; 103 | }; 104 | 97C146EF1CF9000F007C117D /* Products */ = { 105 | isa = PBXGroup; 106 | children = ( 107 | 97C146EE1CF9000F007C117D /* Runner.app */, 108 | ); 109 | name = Products; 110 | sourceTree = ""; 111 | }; 112 | 97C146F01CF9000F007C117D /* Runner */ = { 113 | isa = PBXGroup; 114 | children = ( 115 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 116 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 117 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 118 | 97C147021CF9000F007C117D /* Info.plist */, 119 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 120 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 121 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 122 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, 123 | ); 124 | path = Runner; 125 | sourceTree = ""; 126 | }; 127 | /* End PBXGroup section */ 128 | 129 | /* Begin PBXNativeTarget section */ 130 | 97C146ED1CF9000F007C117D /* Runner */ = { 131 | isa = PBXNativeTarget; 132 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 133 | buildPhases = ( 134 | 7F84C9B4E5ECCA7417D9273F /* [CP] Check Pods Manifest.lock */, 135 | 9740EEB61CF901F6004384FC /* Run Script */, 136 | 97C146EA1CF9000F007C117D /* Sources */, 137 | 97C146EB1CF9000F007C117D /* Frameworks */, 138 | 97C146EC1CF9000F007C117D /* Resources */, 139 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 140 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 141 | 6D3DE76C4252F4B814B9E95E /* [CP] Embed Pods Frameworks */, 142 | ); 143 | buildRules = ( 144 | ); 145 | dependencies = ( 146 | ); 147 | name = Runner; 148 | productName = Runner; 149 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 150 | productType = "com.apple.product-type.application"; 151 | }; 152 | /* End PBXNativeTarget section */ 153 | 154 | /* Begin PBXProject section */ 155 | 97C146E61CF9000F007C117D /* Project object */ = { 156 | isa = PBXProject; 157 | attributes = { 158 | LastUpgradeCheck = 1300; 159 | ORGANIZATIONNAME = ""; 160 | TargetAttributes = { 161 | 97C146ED1CF9000F007C117D = { 162 | CreatedOnToolsVersion = 7.3.1; 163 | LastSwiftMigration = 1100; 164 | }; 165 | }; 166 | }; 167 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 168 | compatibilityVersion = "Xcode 9.3"; 169 | developmentRegion = en; 170 | hasScannedForEncodings = 0; 171 | knownRegions = ( 172 | en, 173 | Base, 174 | ); 175 | mainGroup = 97C146E51CF9000F007C117D; 176 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 177 | projectDirPath = ""; 178 | projectRoot = ""; 179 | targets = ( 180 | 97C146ED1CF9000F007C117D /* Runner */, 181 | ); 182 | }; 183 | /* End PBXProject section */ 184 | 185 | /* Begin PBXResourcesBuildPhase section */ 186 | 97C146EC1CF9000F007C117D /* Resources */ = { 187 | isa = PBXResourcesBuildPhase; 188 | buildActionMask = 2147483647; 189 | files = ( 190 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 191 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 192 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 193 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 194 | ); 195 | runOnlyForDeploymentPostprocessing = 0; 196 | }; 197 | /* End PBXResourcesBuildPhase section */ 198 | 199 | /* Begin PBXShellScriptBuildPhase section */ 200 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 201 | isa = PBXShellScriptBuildPhase; 202 | alwaysOutOfDate = 1; 203 | buildActionMask = 2147483647; 204 | files = ( 205 | ); 206 | inputPaths = ( 207 | ); 208 | name = "Thin Binary"; 209 | outputPaths = ( 210 | ); 211 | runOnlyForDeploymentPostprocessing = 0; 212 | shellPath = /bin/sh; 213 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; 214 | }; 215 | 6D3DE76C4252F4B814B9E95E /* [CP] Embed Pods Frameworks */ = { 216 | isa = PBXShellScriptBuildPhase; 217 | buildActionMask = 2147483647; 218 | files = ( 219 | ); 220 | inputFileListPaths = ( 221 | "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", 222 | ); 223 | name = "[CP] Embed Pods Frameworks"; 224 | outputFileListPaths = ( 225 | "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", 226 | ); 227 | runOnlyForDeploymentPostprocessing = 0; 228 | shellPath = /bin/sh; 229 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; 230 | showEnvVarsInLog = 0; 231 | }; 232 | 7F84C9B4E5ECCA7417D9273F /* [CP] Check Pods Manifest.lock */ = { 233 | isa = PBXShellScriptBuildPhase; 234 | buildActionMask = 2147483647; 235 | files = ( 236 | ); 237 | inputFileListPaths = ( 238 | ); 239 | inputPaths = ( 240 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 241 | "${PODS_ROOT}/Manifest.lock", 242 | ); 243 | name = "[CP] Check Pods Manifest.lock"; 244 | outputFileListPaths = ( 245 | ); 246 | outputPaths = ( 247 | "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", 248 | ); 249 | runOnlyForDeploymentPostprocessing = 0; 250 | shellPath = /bin/sh; 251 | 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"; 252 | showEnvVarsInLog = 0; 253 | }; 254 | 9740EEB61CF901F6004384FC /* Run Script */ = { 255 | isa = PBXShellScriptBuildPhase; 256 | alwaysOutOfDate = 1; 257 | buildActionMask = 2147483647; 258 | files = ( 259 | ); 260 | inputPaths = ( 261 | ); 262 | name = "Run Script"; 263 | outputPaths = ( 264 | ); 265 | runOnlyForDeploymentPostprocessing = 0; 266 | shellPath = /bin/sh; 267 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 268 | }; 269 | /* End PBXShellScriptBuildPhase section */ 270 | 271 | /* Begin PBXSourcesBuildPhase section */ 272 | 97C146EA1CF9000F007C117D /* Sources */ = { 273 | isa = PBXSourcesBuildPhase; 274 | buildActionMask = 2147483647; 275 | files = ( 276 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 277 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 278 | ); 279 | runOnlyForDeploymentPostprocessing = 0; 280 | }; 281 | /* End PBXSourcesBuildPhase section */ 282 | 283 | /* Begin PBXVariantGroup section */ 284 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 285 | isa = PBXVariantGroup; 286 | children = ( 287 | 97C146FB1CF9000F007C117D /* Base */, 288 | ); 289 | name = Main.storyboard; 290 | sourceTree = ""; 291 | }; 292 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 293 | isa = PBXVariantGroup; 294 | children = ( 295 | 97C147001CF9000F007C117D /* Base */, 296 | ); 297 | name = LaunchScreen.storyboard; 298 | sourceTree = ""; 299 | }; 300 | /* End PBXVariantGroup section */ 301 | 302 | /* Begin XCBuildConfiguration section */ 303 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 304 | isa = XCBuildConfiguration; 305 | buildSettings = { 306 | ALWAYS_SEARCH_USER_PATHS = NO; 307 | CLANG_ANALYZER_NONNULL = YES; 308 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 309 | CLANG_CXX_LIBRARY = "libc++"; 310 | CLANG_ENABLE_MODULES = YES; 311 | CLANG_ENABLE_OBJC_ARC = YES; 312 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 313 | CLANG_WARN_BOOL_CONVERSION = YES; 314 | CLANG_WARN_COMMA = YES; 315 | CLANG_WARN_CONSTANT_CONVERSION = YES; 316 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 317 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 318 | CLANG_WARN_EMPTY_BODY = YES; 319 | CLANG_WARN_ENUM_CONVERSION = YES; 320 | CLANG_WARN_INFINITE_RECURSION = YES; 321 | CLANG_WARN_INT_CONVERSION = YES; 322 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 323 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 324 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 325 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 326 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 327 | CLANG_WARN_STRICT_PROTOTYPES = YES; 328 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 329 | CLANG_WARN_UNREACHABLE_CODE = YES; 330 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 331 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 332 | COPY_PHASE_STRIP = NO; 333 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 334 | ENABLE_NS_ASSERTIONS = NO; 335 | ENABLE_STRICT_OBJC_MSGSEND = YES; 336 | GCC_C_LANGUAGE_STANDARD = gnu99; 337 | GCC_NO_COMMON_BLOCKS = YES; 338 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 339 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 340 | GCC_WARN_UNDECLARED_SELECTOR = YES; 341 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 342 | GCC_WARN_UNUSED_FUNCTION = YES; 343 | GCC_WARN_UNUSED_VARIABLE = YES; 344 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 345 | MTL_ENABLE_DEBUG_INFO = NO; 346 | SDKROOT = iphoneos; 347 | SUPPORTED_PLATFORMS = iphoneos; 348 | TARGETED_DEVICE_FAMILY = "1,2"; 349 | VALIDATE_PRODUCT = YES; 350 | }; 351 | name = Profile; 352 | }; 353 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 354 | isa = XCBuildConfiguration; 355 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 356 | buildSettings = { 357 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 358 | CLANG_ENABLE_MODULES = YES; 359 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 360 | DEVELOPMENT_TEAM = URQZL73W77; 361 | ENABLE_BITCODE = NO; 362 | INFOPLIST_FILE = Runner/Info.plist; 363 | LD_RUNPATH_SEARCH_PATHS = ( 364 | "$(inherited)", 365 | "@executable_path/Frameworks", 366 | ); 367 | PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterDioExample; 368 | PRODUCT_NAME = "$(TARGET_NAME)"; 369 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 370 | SWIFT_VERSION = 5.0; 371 | VERSIONING_SYSTEM = "apple-generic"; 372 | }; 373 | name = Profile; 374 | }; 375 | 97C147031CF9000F007C117D /* Debug */ = { 376 | isa = XCBuildConfiguration; 377 | buildSettings = { 378 | ALWAYS_SEARCH_USER_PATHS = NO; 379 | CLANG_ANALYZER_NONNULL = YES; 380 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 381 | CLANG_CXX_LIBRARY = "libc++"; 382 | CLANG_ENABLE_MODULES = YES; 383 | CLANG_ENABLE_OBJC_ARC = YES; 384 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 385 | CLANG_WARN_BOOL_CONVERSION = YES; 386 | CLANG_WARN_COMMA = YES; 387 | CLANG_WARN_CONSTANT_CONVERSION = YES; 388 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 389 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 390 | CLANG_WARN_EMPTY_BODY = YES; 391 | CLANG_WARN_ENUM_CONVERSION = YES; 392 | CLANG_WARN_INFINITE_RECURSION = YES; 393 | CLANG_WARN_INT_CONVERSION = YES; 394 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 395 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 396 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 397 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 398 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 399 | CLANG_WARN_STRICT_PROTOTYPES = YES; 400 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 401 | CLANG_WARN_UNREACHABLE_CODE = YES; 402 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 403 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 404 | COPY_PHASE_STRIP = NO; 405 | DEBUG_INFORMATION_FORMAT = dwarf; 406 | ENABLE_STRICT_OBJC_MSGSEND = YES; 407 | ENABLE_TESTABILITY = YES; 408 | GCC_C_LANGUAGE_STANDARD = gnu99; 409 | GCC_DYNAMIC_NO_PIC = NO; 410 | GCC_NO_COMMON_BLOCKS = YES; 411 | GCC_OPTIMIZATION_LEVEL = 0; 412 | GCC_PREPROCESSOR_DEFINITIONS = ( 413 | "DEBUG=1", 414 | "$(inherited)", 415 | ); 416 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 417 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 418 | GCC_WARN_UNDECLARED_SELECTOR = YES; 419 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 420 | GCC_WARN_UNUSED_FUNCTION = YES; 421 | GCC_WARN_UNUSED_VARIABLE = YES; 422 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 423 | MTL_ENABLE_DEBUG_INFO = YES; 424 | ONLY_ACTIVE_ARCH = YES; 425 | SDKROOT = iphoneos; 426 | TARGETED_DEVICE_FAMILY = "1,2"; 427 | }; 428 | name = Debug; 429 | }; 430 | 97C147041CF9000F007C117D /* Release */ = { 431 | isa = XCBuildConfiguration; 432 | buildSettings = { 433 | ALWAYS_SEARCH_USER_PATHS = NO; 434 | CLANG_ANALYZER_NONNULL = YES; 435 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 436 | CLANG_CXX_LIBRARY = "libc++"; 437 | CLANG_ENABLE_MODULES = YES; 438 | CLANG_ENABLE_OBJC_ARC = YES; 439 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 440 | CLANG_WARN_BOOL_CONVERSION = YES; 441 | CLANG_WARN_COMMA = YES; 442 | CLANG_WARN_CONSTANT_CONVERSION = YES; 443 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 444 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 445 | CLANG_WARN_EMPTY_BODY = YES; 446 | CLANG_WARN_ENUM_CONVERSION = YES; 447 | CLANG_WARN_INFINITE_RECURSION = YES; 448 | CLANG_WARN_INT_CONVERSION = YES; 449 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 450 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 451 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 452 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 453 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 454 | CLANG_WARN_STRICT_PROTOTYPES = YES; 455 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 456 | CLANG_WARN_UNREACHABLE_CODE = YES; 457 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 458 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 459 | COPY_PHASE_STRIP = NO; 460 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 461 | ENABLE_NS_ASSERTIONS = NO; 462 | ENABLE_STRICT_OBJC_MSGSEND = YES; 463 | GCC_C_LANGUAGE_STANDARD = gnu99; 464 | GCC_NO_COMMON_BLOCKS = YES; 465 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 466 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 467 | GCC_WARN_UNDECLARED_SELECTOR = YES; 468 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 469 | GCC_WARN_UNUSED_FUNCTION = YES; 470 | GCC_WARN_UNUSED_VARIABLE = YES; 471 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 472 | MTL_ENABLE_DEBUG_INFO = NO; 473 | SDKROOT = iphoneos; 474 | SUPPORTED_PLATFORMS = iphoneos; 475 | SWIFT_COMPILATION_MODE = wholemodule; 476 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 477 | TARGETED_DEVICE_FAMILY = "1,2"; 478 | VALIDATE_PRODUCT = YES; 479 | }; 480 | name = Release; 481 | }; 482 | 97C147061CF9000F007C117D /* Debug */ = { 483 | isa = XCBuildConfiguration; 484 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 485 | buildSettings = { 486 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 487 | CLANG_ENABLE_MODULES = YES; 488 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 489 | ENABLE_BITCODE = NO; 490 | INFOPLIST_FILE = Runner/Info.plist; 491 | LD_RUNPATH_SEARCH_PATHS = ( 492 | "$(inherited)", 493 | "@executable_path/Frameworks", 494 | ); 495 | PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterDioExample; 496 | PRODUCT_NAME = "$(TARGET_NAME)"; 497 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 498 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 499 | SWIFT_VERSION = 5.0; 500 | VERSIONING_SYSTEM = "apple-generic"; 501 | }; 502 | name = Debug; 503 | }; 504 | 97C147071CF9000F007C117D /* Release */ = { 505 | isa = XCBuildConfiguration; 506 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 507 | buildSettings = { 508 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 509 | CLANG_ENABLE_MODULES = YES; 510 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 511 | ENABLE_BITCODE = NO; 512 | INFOPLIST_FILE = Runner/Info.plist; 513 | LD_RUNPATH_SEARCH_PATHS = ( 514 | "$(inherited)", 515 | "@executable_path/Frameworks", 516 | ); 517 | PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterDioExample; 518 | PRODUCT_NAME = "$(TARGET_NAME)"; 519 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 520 | SWIFT_VERSION = 5.0; 521 | VERSIONING_SYSTEM = "apple-generic"; 522 | }; 523 | name = Release; 524 | }; 525 | /* End XCBuildConfiguration section */ 526 | 527 | /* Begin XCConfigurationList section */ 528 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 529 | isa = XCConfigurationList; 530 | buildConfigurations = ( 531 | 97C147031CF9000F007C117D /* Debug */, 532 | 97C147041CF9000F007C117D /* Release */, 533 | 249021D3217E4FDB00AE95B9 /* Profile */, 534 | ); 535 | defaultConfigurationIsVisible = 0; 536 | defaultConfigurationName = Release; 537 | }; 538 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 539 | isa = XCConfigurationList; 540 | buildConfigurations = ( 541 | 97C147061CF9000F007C117D /* Debug */, 542 | 97C147071CF9000F007C117D /* Release */, 543 | 249021D4217E4FDB00AE95B9 /* Profile */, 544 | ); 545 | defaultConfigurationIsVisible = 0; 546 | defaultConfigurationName = Release; 547 | }; 548 | /* End XCConfigurationList section */ 549 | }; 550 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 551 | } 552 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shahanajparvin/flutter-dio-cache-interceptor_example/9d27e47c5f4f0c3bd6c603bf4ec9c02375c617af/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shahanajparvin/flutter-dio-cache-interceptor_example/9d27e47c5f4f0c3bd6c603bf4ec9c02375c617af/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shahanajparvin/flutter-dio-cache-interceptor_example/9d27e47c5f4f0c3bd6c603bf4ec9c02375c617af/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shahanajparvin/flutter-dio-cache-interceptor_example/9d27e47c5f4f0c3bd6c603bf4ec9c02375c617af/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shahanajparvin/flutter-dio-cache-interceptor_example/9d27e47c5f4f0c3bd6c603bf4ec9c02375c617af/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shahanajparvin/flutter-dio-cache-interceptor_example/9d27e47c5f4f0c3bd6c603bf4ec9c02375c617af/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shahanajparvin/flutter-dio-cache-interceptor_example/9d27e47c5f4f0c3bd6c603bf4ec9c02375c617af/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shahanajparvin/flutter-dio-cache-interceptor_example/9d27e47c5f4f0c3bd6c603bf4ec9c02375c617af/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shahanajparvin/flutter-dio-cache-interceptor_example/9d27e47c5f4f0c3bd6c603bf4ec9c02375c617af/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shahanajparvin/flutter-dio-cache-interceptor_example/9d27e47c5f4f0c3bd6c603bf4ec9c02375c617af/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shahanajparvin/flutter-dio-cache-interceptor_example/9d27e47c5f4f0c3bd6c603bf4ec9c02375c617af/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shahanajparvin/flutter-dio-cache-interceptor_example/9d27e47c5f4f0c3bd6c603bf4ec9c02375c617af/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shahanajparvin/flutter-dio-cache-interceptor_example/9d27e47c5f4f0c3bd6c603bf4ec9c02375c617af/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shahanajparvin/flutter-dio-cache-interceptor_example/9d27e47c5f4f0c3bd6c603bf4ec9c02375c617af/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shahanajparvin/flutter-dio-cache-interceptor_example/9d27e47c5f4f0c3bd6c603bf4ec9c02375c617af/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shahanajparvin/flutter-dio-cache-interceptor_example/9d27e47c5f4f0c3bd6c603bf4ec9c02375c617af/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shahanajparvin/flutter-dio-cache-interceptor_example/9d27e47c5f4f0c3bd6c603bf4ec9c02375c617af/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shahanajparvin/flutter-dio-cache-interceptor_example/9d27e47c5f4f0c3bd6c603bf4ec9c02375c617af/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /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. -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleDisplayName 8 | Flutter Dio Example 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | flutter_dio_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 | -------------------------------------------------------------------------------- /ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /lib/extensions/extensions.dart: -------------------------------------------------------------------------------- 1 | export 'text_extension.dart'; 2 | -------------------------------------------------------------------------------- /lib/extensions/text_extension.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | extension TextExtension on Text { 4 | Text fontSize(double fontSize) { 5 | Text newWidget = Text( 6 | data!, 7 | style: style == null 8 | ? TextStyle(fontSize: fontSize) 9 | : style?.copyWith(fontSize: fontSize), 10 | ); 11 | return newWidget; 12 | } 13 | 14 | Text bold([FontWeight fontWeight = FontWeight.w500]) { 15 | Text newWidget = Text( 16 | data!, 17 | style: style == null 18 | ? TextStyle(fontWeight: fontWeight) 19 | : style?.copyWith(fontWeight: fontWeight), 20 | ); 21 | return newWidget; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_dio_example/view/home_screen.dart'; 3 | 4 | void main() { 5 | runApp(const MyApp()); 6 | } 7 | 8 | class MyApp extends StatelessWidget { 9 | const MyApp({Key? key}) : super(key: key); 10 | 11 | @override 12 | Widget build(BuildContext context) { 13 | return MaterialApp( 14 | title: 'Flutter Dio Example', 15 | debugShowCheckedModeBanner: false, 16 | theme: ThemeData( 17 | primarySwatch: Colors.indigo, 18 | ), 19 | home: const HomeScreen(), 20 | ); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /lib/models/models.dart: -------------------------------------------------------------------------------- 1 | export 'user.dart'; 2 | export 'post.dart'; 3 | -------------------------------------------------------------------------------- /lib/models/post.dart: -------------------------------------------------------------------------------- 1 | class Post { 2 | final int userId; 3 | final int id; 4 | final String title; 5 | final String body; 6 | 7 | Post({ 8 | required this.userId, 9 | required this.id, 10 | required this.title, 11 | required this.body, 12 | }); 13 | 14 | factory Post.fromJson(Map json) { 15 | return Post( 16 | userId: json['userId'], 17 | id: json['id'], 18 | title: json['title'], 19 | body: json['body'], 20 | ); 21 | } 22 | 23 | Map toJson() { 24 | return { 25 | 'userId': userId, 26 | 'id': id, 27 | 'title': title, 28 | 'body': body, 29 | }; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /lib/models/user.dart: -------------------------------------------------------------------------------- 1 | // {"id":3,"name":"Aanjaneya Menon","email":"menon_aanjaneya@rath.biz","gender":"male","status":"active"} 2 | import 'package:equatable/equatable.dart'; 3 | import 'package:json_annotation/json_annotation.dart'; 4 | 5 | part 'user.g.dart'; 6 | 7 | enum Gender { male, female } 8 | 9 | enum Status { active, inactive } 10 | 11 | @JsonSerializable() 12 | class User extends Equatable { 13 | const User({ 14 | this.id, 15 | required this.name, 16 | required this.email, 17 | required this.gender, 18 | required this.status, 19 | }); 20 | 21 | factory User.fromJson(Map json) => _$UserFromJson(json); 22 | 23 | Map toJson() => _$UserToJson(this); 24 | 25 | final int? id; 26 | 27 | final String name; 28 | 29 | final String email; 30 | 31 | final Gender gender; 32 | 33 | final Status status; 34 | 35 | @override 36 | bool? get stringify => true; 37 | 38 | @override 39 | List get props => [id, name, email, gender, status]; 40 | } 41 | -------------------------------------------------------------------------------- /lib/models/user.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'user.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | User _$UserFromJson(Map json) => User( 10 | id: json['id'] as int?, 11 | name: json['name'] as String, 12 | email: json['email'] as String, 13 | gender: $enumDecode(_$GenderEnumMap, json['gender']), 14 | status: $enumDecode(_$StatusEnumMap, json['status']), 15 | ); 16 | 17 | Map _$UserToJson(User instance) => { 18 | 'id': instance.id, 19 | 'name': instance.name, 20 | 'email': instance.email, 21 | 'gender': _$GenderEnumMap[instance.gender], 22 | 'status': _$StatusEnumMap[instance.status], 23 | }; 24 | 25 | const _$GenderEnumMap = { 26 | Gender.male: 'male', 27 | Gender.female: 'female', 28 | }; 29 | 30 | const _$StatusEnumMap = { 31 | Status.active: 'active', 32 | Status.inactive: 'inactive', 33 | }; 34 | -------------------------------------------------------------------------------- /lib/network/api_service.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | import 'package:flutter_dio_example/models/post.dart'; 3 | import 'package:flutter_dio_example/network/dio_exception.dart'; 4 | import 'package:flutter_dio_example/network/endpoints.dart'; 5 | 6 | class ApiService { 7 | 8 | static Future handleApiCall(Future apiCall) async { 9 | try { 10 | final response = await apiCall; 11 | return response; 12 | } on DioError catch (err) { 13 | throw DioException.fromDioError(err); 14 | } catch (e) { 15 | rethrow; 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /lib/network/caller.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | import 'package:dio_cache_interceptor/dio_cache_interceptor.dart'; 3 | import 'dart:io'; 4 | 5 | class Caller { 6 | const Caller({ 7 | required this.cacheStore, 8 | required this.cacheOptions, 9 | required this.dio, 10 | }); 11 | 12 | final CacheStore cacheStore; 13 | final CacheOptions cacheOptions; 14 | final Dio dio; 15 | 16 | Future noCacheCall(String url) async { 17 | final resp = await _call(url: url, policy: CachePolicy.noCache); 18 | if (resp == null) return 'No response'; 19 | return _getResponseContent(resp); 20 | } 21 | 22 | Future requestCall(String url) async { 23 | final resp = await _call(url: url); 24 | if (resp == null) return 'No response'; 25 | return _getResponseContent(resp); 26 | } 27 | 28 | Future refreshCall(String url) async { 29 | final resp = await _call(url: url, policy: CachePolicy.refresh); 30 | if (resp == null) return 'No response'; 31 | return _getResponseContent(resp); 32 | } 33 | 34 | Future forceCacheCall(String url) async { 35 | final resp = await _call(url: url, policy: CachePolicy.forceCache); 36 | if (resp == null) return 'No response'; 37 | return _getResponseContent(resp); 38 | } 39 | 40 | Future refreshForceCacheCall(String url) async { 41 | final resp = await _call(url: url, policy: CachePolicy.refreshForceCache); 42 | if (resp == null) return 'No response'; 43 | return _getResponseContent(resp); 44 | } 45 | 46 | Future deleteEntry(String url) async { 47 | final key = CacheOptions.defaultCacheKeyBuilder( 48 | RequestOptions(path: url), 49 | ); 50 | await cacheStore.delete(key); 51 | return 'Entry "$url" cleared'; 52 | } 53 | 54 | Future cleanStore() async { 55 | await cacheStore.clean(); 56 | return 'Store cleared completely'; 57 | } 58 | 59 | Future _call({ 60 | required String url, 61 | CachePolicy? policy, 62 | }) { 63 | Options? options; 64 | options = cacheOptions.copyWith(policy: policy).toOptions(); 65 | 66 | try { 67 | return dio.get(url, options: options); 68 | } on DioError catch (err) { 69 | return Future.value(null); 70 | } 71 | } 72 | 73 | String _getResponseContent(Response response) { 74 | final date = response.headers[HttpHeaders.dateHeader]?.first; 75 | final etag = response.headers[HttpHeaders.etagHeader]?.first; 76 | final expires = response.headers[HttpHeaders.expiresHeader]?.first; 77 | final lastModified = 78 | response.headers[HttpHeaders.lastModifiedHeader]?.first; 79 | final cacheControl = 80 | response.headers[HttpHeaders.cacheControlHeader]?.first; 81 | 82 | final buffer = StringBuffer(); 83 | buffer.writeln(''); 84 | buffer.writeln('Call returned ${response.statusCode}\n'); 85 | 86 | buffer.writeln('Request headers:'); 87 | buffer.writeln('${response.requestOptions.headers.toString()}\n'); 88 | 89 | buffer.writeln('Response headers (cache related):'); 90 | if (date != null) { 91 | buffer.writeln('${HttpHeaders.dateHeader}: $date'); 92 | } 93 | if (etag != null) { 94 | buffer.writeln('${HttpHeaders.etagHeader}: $etag'); 95 | } 96 | if (expires != null) { 97 | buffer.writeln('${HttpHeaders.expiresHeader}: $expires'); 98 | } 99 | if (lastModified != null) { 100 | buffer.writeln('${HttpHeaders.lastModifiedHeader}: $lastModified'); 101 | } 102 | if (cacheControl != null) { 103 | buffer.writeln('${HttpHeaders.cacheControlHeader}: $cacheControl'); 104 | } 105 | 106 | buffer.writeln(''); 107 | buffer.writeln('Response body (truncated):'); 108 | buffer.writeln('${response.data.toString().substring(0, 200)}...'); 109 | 110 | return buffer.toString(); 111 | } 112 | } -------------------------------------------------------------------------------- /lib/network/dio_exception.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | 3 | class DioException implements Exception { 4 | late String errorMessage; 5 | 6 | DioException.fromDioError(DioError dioError) { 7 | switch (dioError.type) { 8 | case DioErrorType.cancel: 9 | errorMessage = 'Request to the server was cancelled.'; 10 | break; 11 | case DioErrorType.connectTimeout: 12 | errorMessage = 'Connection timed out.'; 13 | break; 14 | case DioErrorType.receiveTimeout: 15 | errorMessage = 'Receiving timeout occurred.'; 16 | break; 17 | case DioErrorType.sendTimeout: 18 | errorMessage = 'Request send timeout.'; 19 | break; 20 | case DioErrorType.response: 21 | errorMessage = _handleStatusCode(dioError.response?.statusCode); 22 | break; 23 | case DioErrorType.other: 24 | if (dioError.message.contains('SocketException')) { 25 | errorMessage = 'No Internet.'; 26 | break; 27 | } 28 | errorMessage = 'Unexpected error occurred.'; 29 | break; 30 | default: 31 | errorMessage = 'Something went wrong'; 32 | break; 33 | } 34 | } 35 | 36 | String _handleStatusCode(int? statusCode) { 37 | switch (statusCode) { 38 | case 400: 39 | return 'Bad request.'; 40 | case 401: 41 | return 'Authentication failed.'; 42 | case 403: 43 | return 'The authenticated user is not allowed to access the specified API endpoint.'; 44 | case 404: 45 | return 'The requested resource does not exist.'; 46 | case 405: 47 | return 'Method not allowed. Please check the Allow header for the allowed HTTP methods.'; 48 | case 415: 49 | return 'Unsupported media type. The requested content type or version number is invalid.'; 50 | case 422: 51 | return 'Data validation failed.'; 52 | case 429: 53 | return 'Too many requests.'; 54 | case 500: 55 | return 'Internal server error.'; 56 | default: 57 | return 'Oops something went wrong!'; 58 | } 59 | } 60 | 61 | @override 62 | String toString() => errorMessage; 63 | } 64 | -------------------------------------------------------------------------------- /lib/network/dio_service.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | import 'package:dio_cache_interceptor/dio_cache_interceptor.dart'; 3 | import 'package:dio_cache_interceptor_hive_store/dio_cache_interceptor_hive_store.dart'; 4 | import 'package:flutter_dio_example/network/api_service.dart'; 5 | import 'package:flutter_dio_example/network/interceptors/authorization_interceptor.dart'; 6 | import 'package:path_provider/path_provider.dart'; 7 | 8 | import '../models/post.dart'; 9 | import 'endpoints.dart'; 10 | import 'interceptors/interceptors.dart'; 11 | 12 | 13 | class DioService { 14 | late Dio _dio; 15 | 16 | // Private constructor 17 | DioService._privateConstructor() { 18 | _initializeDio(); 19 | } 20 | 21 | static final DioService _instance = DioService._privateConstructor(); 22 | 23 | // Singleton instance 24 | static DioService get instance => _instance; 25 | 26 | void _initializeDio() async { 27 | var cacheDir = await getTemporaryDirectory(); 28 | 29 | var cacheStore = HiveCacheStore( 30 | cacheDir.path, 31 | hiveBoxName: "dio_cache_example", 32 | ); 33 | 34 | var customCacheOptions = CacheOptions( 35 | store: cacheStore, 36 | policy: CachePolicy.forceCache, 37 | priority: CachePriority.high, 38 | maxStale: const Duration(minutes: 1), 39 | hitCacheOnErrorExcept: [401, 404], 40 | keyBuilder: (request) { 41 | return request.uri.toString(); 42 | }, 43 | allowPostMethod: false, 44 | ); 45 | 46 | _dio = Dio( 47 | BaseOptions( 48 | baseUrl: Endpoints.baseURL, 49 | connectTimeout: Endpoints.connectionTimeout, 50 | receiveTimeout: Endpoints.receiveTimeout, 51 | responseType: ResponseType.json, 52 | ), 53 | )..interceptors.addAll([ 54 | DioCacheInterceptor(options: customCacheOptions), 55 | LoggerInterceptor() 56 | ]); 57 | } 58 | 59 | Future> fetchPosts() async { 60 | final response = await ApiService.handleApiCall( 61 | _dio.get(Endpoints.users), 62 | ); 63 | print(response); 64 | List users = response.data 65 | .map((data) => Post.fromJson(data)) 66 | .toList() 67 | .cast(); 68 | return users; 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /lib/network/endpoints.dart: -------------------------------------------------------------------------------- 1 | class Endpoints { 2 | Endpoints._(); 3 | 4 | static const String baseURL = 'https://jsonplaceholder.typicode.com'; 5 | 6 | static const int receiveTimeout = 5000; 7 | 8 | static const int connectionTimeout = 3000; 9 | 10 | static const String users = '/posts'; 11 | } 12 | -------------------------------------------------------------------------------- /lib/network/interceptors/authorization_interceptor.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | import 'package:flutter_dio_example/network/dio_exception.dart'; 3 | 4 | // ignore: constant_identifier_names 5 | const String API_KEY = 6 | 'cdc9a8ca8aa17b6bed3aa3611a835105bbb4632514d7ca8cf55dbbc5966a7cae'; 7 | 8 | //* Request methods PUT, POST, PATCH, DELETE needs access token, 9 | //* which needs to be passed with "Authorization" header as Bearer token. 10 | class AuthorizationInterceptor extends Interceptor { 11 | get Fluttertoast => null; 12 | 13 | @override 14 | void onRequest(RequestOptions options, RequestInterceptorHandler handler) { 15 | print('-------gffhfhfg'); 16 | if (_needAuthorizationHeader(options)) { 17 | options.headers['Authorization'] = 'Bearer $API_KEY'; 18 | } 19 | super.onRequest(options, handler); 20 | } 21 | 22 | @override 23 | void onError(DioError err, ErrorInterceptorHandler handler) { 24 | final errorMessage = DioException.fromDioError(err).toString(); 25 | 26 | print('---cvcxvcxvcx'+errorMessage); 27 | 28 | /* Fluttertoast.showToast( 29 | msg: errorMessage, 30 | toastLength: Toast.LENGTH_LONG, 31 | gravity: ToastGravity.BOTTOM, 32 | backgroundColor: Colors.red, 33 | textColor: Colors.white, 34 | );*/ 35 | 36 | super.onError(err, handler); 37 | } 38 | 39 | bool _needAuthorizationHeader(RequestOptions options) { 40 | if (options.method == 'GET') { 41 | return false; 42 | } else { 43 | return true; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /lib/network/interceptors/dio_cache_interceptor.dart: -------------------------------------------------------------------------------- 1 | /* 2 | import 'dart:io'; 3 | 4 | import 'package:dio/dio.dart'; 5 | import 'package:dio_cache_interceptor/dio_cache_interceptor.dart'; 6 | import 'package:dio_cache_interceptor/src/model/cache_strategy.dart'; 7 | import 'package:dio_cache_interceptor_hive_store/dio_cache_interceptor_hive_store.dart'; 8 | import 'package:path_provider/path_provider.dart'; 9 | 10 | 11 | 12 | class CustomDioCacheInterceptor extends DioCacheInterceptor { 13 | //late final Directory cacheDir; 14 | // late final HiveCacheStore cacheStore; 15 | 16 | CustomDioCacheInterceptor({CacheOptions? customCacheOptions}) 17 | : super(options: customCacheOptions ?? defaultCacheOptions) { 18 | _initializeCache(); 19 | } 20 | 21 | void _initializeCache() async { 22 | cacheDir = await getTemporaryDirectory(); 23 | 24 | static HiveCacheStore cacheStore = HiveCacheStore( 25 | cacheDir.path, 26 | hiveBoxName: "your_app_name", 27 | ); 28 | } 29 | 30 | static CacheOptions defaultCacheOptions = CacheOptions( 31 | store: HiveCacheStore( 32 | cacheDir.path, 33 | hiveBoxName: "your_app_name", 34 | ), 35 | policy: CachePolicy.forceCache, 36 | priority: CachePriority.high, 37 | maxStale: const Duration(minutes: 5), 38 | hitCacheOnErrorExcept: [401, 404], 39 | keyBuilder: (request) { 40 | return request.uri.toString(); 41 | }, 42 | allowPostMethod: false, store: null, 43 | ); 44 | } 45 | */ 46 | -------------------------------------------------------------------------------- /lib/network/interceptors/interceptors.dart: -------------------------------------------------------------------------------- 1 | export 'authorization_interceptor.dart'; 2 | export 'logger_interceptor.dart'; 3 | -------------------------------------------------------------------------------- /lib/network/interceptors/logger_interceptor.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | import 'package:flutter_dio_example/network/dio_exception.dart'; 3 | import 'package:logger/logger.dart'; 4 | 5 | class LoggerInterceptor extends Interceptor { 6 | Logger logger = Logger( 7 | printer: PrettyPrinter( 8 | methodCount: 0, 9 | errorMethodCount: 5, 10 | lineLength: 75, 11 | colors: true, 12 | printEmojis: true, 13 | printTime: false, 14 | ), 15 | ); 16 | 17 | @override 18 | void onError(DioError err, ErrorInterceptorHandler handler) { 19 | final options = err.requestOptions; 20 | final requestPath = '${options.baseUrl}${options.path}'; 21 | logger.e('${options.method} request => $requestPath'); 22 | logger.d('Error: ${err.error}, Message: ${err.message}'); 23 | final errorMessage = DioException.fromDioError(err).toString(); 24 | return super.onError(err, handler); 25 | } 26 | 27 | @override 28 | void onRequest(RequestOptions options, RequestInterceptorHandler handler) { 29 | final requestPath = '${options.baseUrl}${options.path}'; 30 | logger.i('${options.method} request => $requestPath'); 31 | return super.onRequest(options, handler); 32 | } 33 | 34 | @override 35 | void onResponse(Response response, ResponseInterceptorHandler handler) { 36 | logger.d('StatusCode: ${response.statusCode}, Data: ${response.data}'); 37 | return super.onResponse(response, handler); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /lib/network/network.dart: -------------------------------------------------------------------------------- 1 | export 'endpoints.dart'; 2 | export 'dio_exception.dart'; 3 | 4 | -------------------------------------------------------------------------------- /lib/view/home_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_dio_example/extensions/extensions.dart'; 3 | import 'package:flutter_dio_example/models/models.dart'; 4 | import 'package:flutter_dio_example/network/network.dart'; 5 | import 'package:flutter_dio_example/widgets/widgets.dart'; 6 | 7 | import '../network/dio_service.dart'; 8 | 9 | class HomeScreen extends StatefulWidget { 10 | const HomeScreen({Key? key}) : super(key: key); 11 | 12 | @override 13 | State createState() => _HomeScreenState(); 14 | } 15 | 16 | class _HomeScreenState extends State { 17 | 18 | bool isDone = false; 19 | // late DioService dioService; 20 | 21 | @override 22 | void initState() { 23 | super.initState(); 24 | } 25 | 26 | @override 27 | Widget build(BuildContext context) { 28 | return Scaffold( 29 | appBar: AppBar( 30 | title: const Text('Post List'), 31 | ), 32 | body: FutureBuilder>( 33 | future: DioService.instance.fetchPosts(), 34 | builder: (context, snapshot) { 35 | if (snapshot.connectionState == ConnectionState.waiting) { 36 | return const OutputPanel(showLoading: true); 37 | } else if (snapshot.hasError) { 38 | return OutputError(errorMessage: snapshot.error.toString()); 39 | } else if(snapshot.hasData){ 40 | return PostListWidget(snapshot: snapshot,); 41 | }else{ 42 | return const OutputPanel(); 43 | } 44 | }) 45 | ); 46 | } 47 | } 48 | 49 | class PostListWidget extends StatelessWidget { 50 | 51 | final snapshot; 52 | 53 | const PostListWidget({Key? key, this.snapshot}) : super(key: key); 54 | 55 | @override 56 | Widget build(BuildContext context) { 57 | return ListView.builder( 58 | itemCount: snapshot.data!.length, 59 | itemBuilder: (context, index) { 60 | return ListTile( 61 | title: Text(snapshot.data![index].title), 62 | subtitle: Text(snapshot.data![index].body), 63 | ); 64 | }, 65 | ); 66 | } 67 | } 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /lib/widgets/output_error.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_dio_example/extensions/extensions.dart'; 3 | 4 | class OutputError extends StatelessWidget { 5 | const OutputError({Key? key, required this.errorMessage}) : super(key: key); 6 | final String errorMessage; 7 | 8 | @override 9 | Widget build(BuildContext context) { 10 | return Container( 11 | height: 60.0, 12 | decoration: BoxDecoration( 13 | color: Colors.grey[200], 14 | borderRadius: BorderRadius.circular(8.0), 15 | ), 16 | padding: const EdgeInsets.all(10.0), 17 | child: Column( 18 | crossAxisAlignment: CrossAxisAlignment.stretch, 19 | children: [ 20 | Text( 21 | 'An error occurred', 22 | style: TextStyle(color: Colors.red[800]), 23 | ).fontSize(16).bold(), 24 | Text(errorMessage).fontSize(15), 25 | ], 26 | ), 27 | ); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /lib/widgets/output_panel.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_dio_example/extensions/extensions.dart'; 3 | import 'package:flutter_dio_example/models/models.dart'; 4 | 5 | class OutputPanel extends StatelessWidget { 6 | const OutputPanel({ 7 | Key? key, 8 | this.user, 9 | this.showLoading = false, 10 | }) : super(key: key); 11 | final User? user; 12 | final bool showLoading; 13 | 14 | @override 15 | Widget build(BuildContext context) { 16 | return Container( 17 | height: 195.0, 18 | decoration: BoxDecoration( 19 | color: Colors.grey[200], 20 | borderRadius: BorderRadius.circular(8.0), 21 | ), 22 | padding: const EdgeInsets.all(10.0), 23 | child: Column( 24 | crossAxisAlignment: CrossAxisAlignment.stretch, 25 | children: [ 26 | const Text('Output Log').fontSize(15.0).bold(), 27 | const SizedBox(height: 16.0), 28 | showLoading 29 | ? const Center(child: CircularProgressIndicator()) 30 | : user == null 31 | ? const Center(child: Text('No output log to show')) 32 | : Padding( 33 | padding: const EdgeInsets.symmetric(horizontal: 12.0), 34 | child: Column( 35 | children: [ 36 | UserData( 37 | dataKey: 'id', 38 | dataValue: user!.id!.toString(), 39 | ), 40 | UserData(dataKey: 'name', dataValue: user!.name), 41 | UserData(dataKey: 'email', dataValue: user!.email), 42 | UserData( 43 | dataKey: 'gender', 44 | dataValue: user!.gender.toString(), 45 | ), 46 | UserData( 47 | dataKey: 'status', 48 | dataValue: user!.status.toString(), 49 | ), 50 | ], 51 | ), 52 | ), 53 | ], 54 | ), 55 | ); 56 | } 57 | } 58 | 59 | class UserData extends StatelessWidget { 60 | const UserData({ 61 | Key? key, 62 | required this.dataKey, 63 | required this.dataValue, 64 | }) : super(key: key); 65 | final String dataKey; 66 | final String dataValue; 67 | 68 | @override 69 | Widget build(BuildContext context) { 70 | return Padding( 71 | padding: const EdgeInsets.only(bottom: 4.0), 72 | child: Row( 73 | children: [ 74 | Expanded(flex: 1, child: Text('$dataKey: ').fontSize(15.0).bold()), 75 | Expanded(flex: 3, child: Text(dataValue).fontSize(15.0)), 76 | ], 77 | ), 78 | ); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /lib/widgets/output_success.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_dio_example/extensions/extensions.dart'; 3 | 4 | class OutputSuccess extends StatelessWidget { 5 | const OutputSuccess({Key? key, required this.successMessage}) 6 | : super(key: key); 7 | final String successMessage; 8 | 9 | @override 10 | Widget build(BuildContext context) { 11 | return Container( 12 | height: 60.0, 13 | decoration: BoxDecoration( 14 | color: Colors.grey[200], 15 | borderRadius: BorderRadius.circular(8.0), 16 | ), 17 | padding: const EdgeInsets.all(10.0), 18 | child: Column( 19 | crossAxisAlignment: CrossAxisAlignment.stretch, 20 | children: [ 21 | Text( 22 | 'Operation successful!', 23 | style: TextStyle(color: Colors.green[600]), 24 | ).fontSize(16).bold(), 25 | Text(successMessage).fontSize(15), 26 | ], 27 | ), 28 | ); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /lib/widgets/widgets.dart: -------------------------------------------------------------------------------- 1 | export 'output_panel.dart'; 2 | export 'output_error.dart'; 3 | export 'output_success.dart'; 4 | 5 | -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | _fe_analyzer_shared: 5 | dependency: transitive 6 | description: 7 | name: _fe_analyzer_shared 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "50.0.0" 11 | analyzer: 12 | dependency: transitive 13 | description: 14 | name: analyzer 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "5.2.0" 18 | args: 19 | dependency: transitive 20 | description: 21 | name: args 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "2.4.1" 25 | async: 26 | dependency: transitive 27 | description: 28 | name: async 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "2.9.0" 32 | boolean_selector: 33 | dependency: transitive 34 | description: 35 | name: boolean_selector 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "2.1.0" 39 | build: 40 | dependency: transitive 41 | description: 42 | name: build 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "2.3.1" 46 | build_config: 47 | dependency: transitive 48 | description: 49 | name: build_config 50 | url: "https://pub.dartlang.org" 51 | source: hosted 52 | version: "1.1.1" 53 | build_daemon: 54 | dependency: transitive 55 | description: 56 | name: build_daemon 57 | url: "https://pub.dartlang.org" 58 | source: hosted 59 | version: "3.1.1" 60 | build_resolvers: 61 | dependency: transitive 62 | description: 63 | name: build_resolvers 64 | url: "https://pub.dartlang.org" 65 | source: hosted 66 | version: "2.1.0" 67 | build_runner: 68 | dependency: "direct dev" 69 | description: 70 | name: build_runner 71 | url: "https://pub.dartlang.org" 72 | source: hosted 73 | version: "2.3.3" 74 | build_runner_core: 75 | dependency: transitive 76 | description: 77 | name: build_runner_core 78 | url: "https://pub.dartlang.org" 79 | source: hosted 80 | version: "7.2.7" 81 | built_collection: 82 | dependency: transitive 83 | description: 84 | name: built_collection 85 | url: "https://pub.dartlang.org" 86 | source: hosted 87 | version: "5.1.1" 88 | built_value: 89 | dependency: transitive 90 | description: 91 | name: built_value 92 | url: "https://pub.dartlang.org" 93 | source: hosted 94 | version: "8.6.2" 95 | characters: 96 | dependency: transitive 97 | description: 98 | name: characters 99 | url: "https://pub.dartlang.org" 100 | source: hosted 101 | version: "1.2.1" 102 | checked_yaml: 103 | dependency: transitive 104 | description: 105 | name: checked_yaml 106 | url: "https://pub.dartlang.org" 107 | source: hosted 108 | version: "2.0.2" 109 | clock: 110 | dependency: transitive 111 | description: 112 | name: clock 113 | url: "https://pub.dartlang.org" 114 | source: hosted 115 | version: "1.1.1" 116 | code_builder: 117 | dependency: transitive 118 | description: 119 | name: code_builder 120 | url: "https://pub.dartlang.org" 121 | source: hosted 122 | version: "4.4.0" 123 | collection: 124 | dependency: transitive 125 | description: 126 | name: collection 127 | url: "https://pub.dartlang.org" 128 | source: hosted 129 | version: "1.16.0" 130 | convert: 131 | dependency: transitive 132 | description: 133 | name: convert 134 | url: "https://pub.dartlang.org" 135 | source: hosted 136 | version: "3.1.1" 137 | crypto: 138 | dependency: transitive 139 | description: 140 | name: crypto 141 | url: "https://pub.dartlang.org" 142 | source: hosted 143 | version: "3.0.2" 144 | cupertino_icons: 145 | dependency: "direct main" 146 | description: 147 | name: cupertino_icons 148 | url: "https://pub.dartlang.org" 149 | source: hosted 150 | version: "1.0.5" 151 | dart_style: 152 | dependency: transitive 153 | description: 154 | name: dart_style 155 | url: "https://pub.dartlang.org" 156 | source: hosted 157 | version: "2.2.5" 158 | dio: 159 | dependency: "direct main" 160 | description: 161 | name: dio 162 | url: "https://pub.dartlang.org" 163 | source: hosted 164 | version: "4.0.6" 165 | dio_cache_interceptor: 166 | dependency: "direct main" 167 | description: 168 | name: dio_cache_interceptor 169 | url: "https://pub.dartlang.org" 170 | source: hosted 171 | version: "3.4.2" 172 | dio_cache_interceptor_hive_store: 173 | dependency: "direct main" 174 | description: 175 | name: dio_cache_interceptor_hive_store 176 | url: "https://pub.dartlang.org" 177 | source: hosted 178 | version: "3.2.1" 179 | equatable: 180 | dependency: "direct main" 181 | description: 182 | name: equatable 183 | url: "https://pub.dartlang.org" 184 | source: hosted 185 | version: "2.0.5" 186 | fake_async: 187 | dependency: transitive 188 | description: 189 | name: fake_async 190 | url: "https://pub.dartlang.org" 191 | source: hosted 192 | version: "1.3.1" 193 | ffi: 194 | dependency: transitive 195 | description: 196 | name: ffi 197 | url: "https://pub.dartlang.org" 198 | source: hosted 199 | version: "2.0.2" 200 | file: 201 | dependency: transitive 202 | description: 203 | name: file 204 | url: "https://pub.dartlang.org" 205 | source: hosted 206 | version: "6.1.4" 207 | fixnum: 208 | dependency: transitive 209 | description: 210 | name: fixnum 211 | url: "https://pub.dartlang.org" 212 | source: hosted 213 | version: "1.0.1" 214 | flutter: 215 | dependency: "direct main" 216 | description: flutter 217 | source: sdk 218 | version: "0.0.0" 219 | flutter_lints: 220 | dependency: "direct dev" 221 | description: 222 | name: flutter_lints 223 | url: "https://pub.dartlang.org" 224 | source: hosted 225 | version: "2.0.2" 226 | flutter_test: 227 | dependency: "direct dev" 228 | description: flutter 229 | source: sdk 230 | version: "0.0.0" 231 | frontend_server_client: 232 | dependency: transitive 233 | description: 234 | name: frontend_server_client 235 | url: "https://pub.dartlang.org" 236 | source: hosted 237 | version: "3.2.0" 238 | glob: 239 | dependency: transitive 240 | description: 241 | name: glob 242 | url: "https://pub.dartlang.org" 243 | source: hosted 244 | version: "2.1.1" 245 | graphs: 246 | dependency: transitive 247 | description: 248 | name: graphs 249 | url: "https://pub.dartlang.org" 250 | source: hosted 251 | version: "2.3.1" 252 | hive: 253 | dependency: transitive 254 | description: 255 | name: hive 256 | url: "https://pub.dartlang.org" 257 | source: hosted 258 | version: "2.2.3" 259 | http_multi_server: 260 | dependency: transitive 261 | description: 262 | name: http_multi_server 263 | url: "https://pub.dartlang.org" 264 | source: hosted 265 | version: "3.2.1" 266 | http_parser: 267 | dependency: transitive 268 | description: 269 | name: http_parser 270 | url: "https://pub.dartlang.org" 271 | source: hosted 272 | version: "4.0.2" 273 | io: 274 | dependency: transitive 275 | description: 276 | name: io 277 | url: "https://pub.dartlang.org" 278 | source: hosted 279 | version: "1.0.4" 280 | js: 281 | dependency: transitive 282 | description: 283 | name: js 284 | url: "https://pub.dartlang.org" 285 | source: hosted 286 | version: "0.6.5" 287 | json_annotation: 288 | dependency: "direct main" 289 | description: 290 | name: json_annotation 291 | url: "https://pub.dartlang.org" 292 | source: hosted 293 | version: "4.8.0" 294 | json_serializable: 295 | dependency: "direct dev" 296 | description: 297 | name: json_serializable 298 | url: "https://pub.dartlang.org" 299 | source: hosted 300 | version: "6.6.1" 301 | lints: 302 | dependency: transitive 303 | description: 304 | name: lints 305 | url: "https://pub.dartlang.org" 306 | source: hosted 307 | version: "2.0.1" 308 | logger: 309 | dependency: "direct main" 310 | description: 311 | name: logger 312 | url: "https://pub.dartlang.org" 313 | source: hosted 314 | version: "1.4.0" 315 | logging: 316 | dependency: transitive 317 | description: 318 | name: logging 319 | url: "https://pub.dartlang.org" 320 | source: hosted 321 | version: "1.1.1" 322 | matcher: 323 | dependency: transitive 324 | description: 325 | name: matcher 326 | url: "https://pub.dartlang.org" 327 | source: hosted 328 | version: "0.12.12" 329 | material_color_utilities: 330 | dependency: transitive 331 | description: 332 | name: material_color_utilities 333 | url: "https://pub.dartlang.org" 334 | source: hosted 335 | version: "0.1.5" 336 | meta: 337 | dependency: transitive 338 | description: 339 | name: meta 340 | url: "https://pub.dartlang.org" 341 | source: hosted 342 | version: "1.8.0" 343 | mime: 344 | dependency: transitive 345 | description: 346 | name: mime 347 | url: "https://pub.dartlang.org" 348 | source: hosted 349 | version: "1.0.4" 350 | package_config: 351 | dependency: transitive 352 | description: 353 | name: package_config 354 | url: "https://pub.dartlang.org" 355 | source: hosted 356 | version: "2.1.0" 357 | path: 358 | dependency: transitive 359 | description: 360 | name: path 361 | url: "https://pub.dartlang.org" 362 | source: hosted 363 | version: "1.8.2" 364 | path_provider: 365 | dependency: "direct main" 366 | description: 367 | name: path_provider 368 | url: "https://pub.dartlang.org" 369 | source: hosted 370 | version: "2.1.0" 371 | path_provider_android: 372 | dependency: transitive 373 | description: 374 | name: path_provider_android 375 | url: "https://pub.dartlang.org" 376 | source: hosted 377 | version: "2.1.0" 378 | path_provider_foundation: 379 | dependency: transitive 380 | description: 381 | name: path_provider_foundation 382 | url: "https://pub.dartlang.org" 383 | source: hosted 384 | version: "2.3.0" 385 | path_provider_linux: 386 | dependency: transitive 387 | description: 388 | name: path_provider_linux 389 | url: "https://pub.dartlang.org" 390 | source: hosted 391 | version: "2.2.0" 392 | path_provider_platform_interface: 393 | dependency: transitive 394 | description: 395 | name: path_provider_platform_interface 396 | url: "https://pub.dartlang.org" 397 | source: hosted 398 | version: "2.1.0" 399 | path_provider_windows: 400 | dependency: transitive 401 | description: 402 | name: path_provider_windows 403 | url: "https://pub.dartlang.org" 404 | source: hosted 405 | version: "2.2.0" 406 | platform: 407 | dependency: transitive 408 | description: 409 | name: platform 410 | url: "https://pub.dartlang.org" 411 | source: hosted 412 | version: "3.1.1" 413 | plugin_platform_interface: 414 | dependency: transitive 415 | description: 416 | name: plugin_platform_interface 417 | url: "https://pub.dartlang.org" 418 | source: hosted 419 | version: "2.1.5" 420 | pool: 421 | dependency: transitive 422 | description: 423 | name: pool 424 | url: "https://pub.dartlang.org" 425 | source: hosted 426 | version: "1.5.1" 427 | pub_semver: 428 | dependency: transitive 429 | description: 430 | name: pub_semver 431 | url: "https://pub.dartlang.org" 432 | source: hosted 433 | version: "2.1.4" 434 | pubspec_parse: 435 | dependency: transitive 436 | description: 437 | name: pubspec_parse 438 | url: "https://pub.dartlang.org" 439 | source: hosted 440 | version: "1.2.3" 441 | shelf: 442 | dependency: transitive 443 | description: 444 | name: shelf 445 | url: "https://pub.dartlang.org" 446 | source: hosted 447 | version: "1.4.1" 448 | shelf_web_socket: 449 | dependency: transitive 450 | description: 451 | name: shelf_web_socket 452 | url: "https://pub.dartlang.org" 453 | source: hosted 454 | version: "1.0.4" 455 | sky_engine: 456 | dependency: transitive 457 | description: flutter 458 | source: sdk 459 | version: "0.0.99" 460 | source_gen: 461 | dependency: transitive 462 | description: 463 | name: source_gen 464 | url: "https://pub.dartlang.org" 465 | source: hosted 466 | version: "1.3.2" 467 | source_helper: 468 | dependency: transitive 469 | description: 470 | name: source_helper 471 | url: "https://pub.dartlang.org" 472 | source: hosted 473 | version: "1.3.3" 474 | source_span: 475 | dependency: transitive 476 | description: 477 | name: source_span 478 | url: "https://pub.dartlang.org" 479 | source: hosted 480 | version: "1.9.0" 481 | stack_trace: 482 | dependency: transitive 483 | description: 484 | name: stack_trace 485 | url: "https://pub.dartlang.org" 486 | source: hosted 487 | version: "1.10.0" 488 | stream_channel: 489 | dependency: transitive 490 | description: 491 | name: stream_channel 492 | url: "https://pub.dartlang.org" 493 | source: hosted 494 | version: "2.1.0" 495 | stream_transform: 496 | dependency: transitive 497 | description: 498 | name: stream_transform 499 | url: "https://pub.dartlang.org" 500 | source: hosted 501 | version: "2.1.0" 502 | string_scanner: 503 | dependency: transitive 504 | description: 505 | name: string_scanner 506 | url: "https://pub.dartlang.org" 507 | source: hosted 508 | version: "1.1.1" 509 | term_glyph: 510 | dependency: transitive 511 | description: 512 | name: term_glyph 513 | url: "https://pub.dartlang.org" 514 | source: hosted 515 | version: "1.2.1" 516 | test_api: 517 | dependency: transitive 518 | description: 519 | name: test_api 520 | url: "https://pub.dartlang.org" 521 | source: hosted 522 | version: "0.4.12" 523 | timing: 524 | dependency: transitive 525 | description: 526 | name: timing 527 | url: "https://pub.dartlang.org" 528 | source: hosted 529 | version: "1.0.1" 530 | typed_data: 531 | dependency: transitive 532 | description: 533 | name: typed_data 534 | url: "https://pub.dartlang.org" 535 | source: hosted 536 | version: "1.3.2" 537 | uuid: 538 | dependency: transitive 539 | description: 540 | name: uuid 541 | url: "https://pub.dartlang.org" 542 | source: hosted 543 | version: "3.0.7" 544 | vector_math: 545 | dependency: transitive 546 | description: 547 | name: vector_math 548 | url: "https://pub.dartlang.org" 549 | source: hosted 550 | version: "2.1.2" 551 | watcher: 552 | dependency: transitive 553 | description: 554 | name: watcher 555 | url: "https://pub.dartlang.org" 556 | source: hosted 557 | version: "1.0.2" 558 | web_socket_channel: 559 | dependency: transitive 560 | description: 561 | name: web_socket_channel 562 | url: "https://pub.dartlang.org" 563 | source: hosted 564 | version: "2.4.0" 565 | win32: 566 | dependency: transitive 567 | description: 568 | name: win32 569 | url: "https://pub.dartlang.org" 570 | source: hosted 571 | version: "4.1.4" 572 | xdg_directories: 573 | dependency: transitive 574 | description: 575 | name: xdg_directories 576 | url: "https://pub.dartlang.org" 577 | source: hosted 578 | version: "1.0.2" 579 | yaml: 580 | dependency: transitive 581 | description: 582 | name: yaml 583 | url: "https://pub.dartlang.org" 584 | source: hosted 585 | version: "3.1.1" 586 | sdks: 587 | dart: ">=2.18.0 <3.0.0" 588 | flutter: ">=3.3.0" 589 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_dio_cache_intercepter_example 2 | description: A new Flutter project. 3 | 4 | publish_to: "none" 5 | 6 | version: 1.0.0+1 7 | 8 | environment: 9 | sdk: ">=2.17.0 <3.0.0" 10 | 11 | dependencies: 12 | cupertino_icons: ^1.0.2 13 | dio: ^4.0.6 14 | equatable: ^2.0.3 15 | flutter: 16 | sdk: flutter 17 | json_annotation: ^4.5.0 18 | logger: ^1.1.0 19 | dio_cache_interceptor: ^3.4.2 20 | dio_cache_interceptor_hive_store: ^3.2.1 21 | path_provider: ^2.1.0 22 | 23 | dev_dependencies: 24 | build_runner: ^2.1.11 25 | flutter_lints: ^2.0.0 26 | flutter_test: 27 | sdk: flutter 28 | json_serializable: ^6.2.0 29 | 30 | flutter: 31 | uses-material-design: true 32 | 33 | 34 | assets: 35 | - assets/ 36 | -------------------------------------------------------------------------------- /test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility in the flutter_test package. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_test/flutter_test.dart'; 10 | 11 | import 'package:flutter_dio_example/main.dart'; 12 | 13 | void main() { 14 | testWidgets('Counter increments smoke test', (WidgetTester tester) async { 15 | // Build our app and trigger a frame. 16 | // await tester.pumpWidget(const MyApp()); 17 | 18 | // Verify that our counter starts at 0. 19 | expect(find.text('0'), findsOneWidget); 20 | expect(find.text('1'), findsNothing); 21 | 22 | // Tap the '+' icon and trigger a frame. 23 | await tester.tap(find.byIcon(Icons.add)); 24 | await tester.pump(); 25 | 26 | // Verify that our counter has incremented. 27 | expect(find.text('0'), findsNothing); 28 | expect(find.text('1'), findsOneWidget); 29 | }); 30 | } 31 | -------------------------------------------------------------------------------- /web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shahanajparvin/flutter-dio-cache-interceptor_example/9d27e47c5f4f0c3bd6c603bf4ec9c02375c617af/web/favicon.png -------------------------------------------------------------------------------- /web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shahanajparvin/flutter-dio-cache-interceptor_example/9d27e47c5f4f0c3bd6c603bf4ec9c02375c617af/web/icons/Icon-192.png -------------------------------------------------------------------------------- /web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shahanajparvin/flutter-dio-cache-interceptor_example/9d27e47c5f4f0c3bd6c603bf4ec9c02375c617af/web/icons/Icon-512.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shahanajparvin/flutter-dio-cache-interceptor_example/9d27e47c5f4f0c3bd6c603bf4ec9c02375c617af/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shahanajparvin/flutter-dio-cache-interceptor_example/9d27e47c5f4f0c3bd6c603bf4ec9c02375c617af/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | flutter_dio_example 33 | 34 | 35 | 39 | 40 | 41 | 42 | 43 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "flutter_dio_example", 3 | "short_name": "flutter_dio_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 | --------------------------------------------------------------------------------