├── .gitignore
├── LICENSE
├── README.md
├── images
├── cover.png
├── screenshot1.png
└── screenshot2.png
└── marvel_comics
├── .gitignore
├── .metadata
├── analysis_options.yaml
├── android
├── .gitignore
├── app
│ ├── build.gradle
│ └── src
│ │ ├── debug
│ │ └── AndroidManifest.xml
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── kotlin
│ │ │ └── com
│ │ │ │ └── example
│ │ │ │ └── marvel_comics
│ │ │ │ └── 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
├── build.yaml
├── 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
├── domain
│ ├── api
│ │ ├── converter
│ │ │ └── int_to_string_converter.dart
│ │ ├── dio
│ │ │ ├── certificates
│ │ │ │ ├── certificates_management.dart
│ │ │ │ └── marvel_api_certificate.dart
│ │ │ ├── dio_factory.dart
│ │ │ ├── interceptors
│ │ │ │ ├── append_headers_interceptor.dart
│ │ │ │ ├── append_timestamp_interceptor.dart
│ │ │ │ ├── example_interceptor.dart
│ │ │ │ ├── marvel_api_auth_interceptor.dart
│ │ │ │ ├── proxy_interceptor.dart
│ │ │ │ └── secure_action_interceptor.dart
│ │ │ └── proxy
│ │ │ │ ├── proxy_finder.dart
│ │ │ │ ├── proxy_holder.dart
│ │ │ │ ├── proxy_reader.dart
│ │ │ │ └── proxy_settings.dart
│ │ ├── example_api.dart
│ │ ├── example_api.g.dart
│ │ ├── headers_example_api.dart
│ │ ├── headers_example_api.g.dart
│ │ ├── marvel_api_consts.dart
│ │ ├── marvel_comics_api.dart
│ │ ├── marvel_comics_api.g.dart
│ │ ├── model
│ │ │ ├── marvel_api_response.dart
│ │ │ └── marvel_api_response.g.dart
│ │ ├── request_annotations.dart
│ │ └── service
│ │ │ └── marvel_api_key_service.dart
│ ├── data
│ │ ├── headers_example_repository.dart
│ │ ├── marvel_comics_repository.dart
│ │ └── secret_data_repository.dart
│ ├── global
│ │ └── navigator_key.dart
│ ├── marvel_api_example.dart
│ ├── model
│ │ ├── marvel_comic.dart
│ │ ├── marvel_comic.freezed.dart
│ │ ├── marvel_comic.g.dart
│ │ ├── marvel_comic_format.dart
│ │ ├── marvel_creator_list.dart
│ │ ├── marvel_creator_list.freezed.dart
│ │ ├── marvel_creator_list.g.dart
│ │ ├── marvel_creator_summary.dart
│ │ ├── marvel_creator_summary.freezed.dart
│ │ ├── marvel_creator_summary.g.dart
│ │ ├── marvel_image.dart
│ │ ├── marvel_image.freezed.dart
│ │ ├── marvel_image.g.dart
│ │ ├── marvel_paginated_list.dart
│ │ ├── marvel_paginated_list.g.dart
│ │ ├── marvel_series_format.dart
│ │ ├── marvel_series_summary.dart
│ │ ├── marvel_series_summary.freezed.dart
│ │ ├── marvel_series_summary.g.dart
│ │ ├── marvel_series_summary_metadata.dart
│ │ ├── marvel_series_summary_metadata.freezed.dart
│ │ ├── marvel_series_summary_metadata.g.dart
│ │ ├── marvel_story_list.dart
│ │ ├── marvel_story_list.freezed.dart
│ │ ├── marvel_story_list.g.dart
│ │ ├── marvel_story_summary.dart
│ │ ├── marvel_story_summary.freezed.dart
│ │ └── marvel_story_summary.g.dart
│ └── service
│ │ ├── dialog_service.dart
│ │ └── headers_services.dart
├── main.dart
└── utility
│ └── hash_utility.dart
├── pubspec.lock
├── pubspec.yaml
└── test
└── domain
└── data
├── marvel_comics_api_get_comics_response_data.dart
├── marvel_comics_api_mock_interceptor.dart
├── marvel_comics_repository_sociable_test.dart
└── marvel_comics_repository_solitary_test.dart
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 Anna (Domashych) Leushchenko
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 | # Basic and advanced networking in Dart and Flutter - the Tide way
2 |
3 | Most applications, be it mobile, web, or desktop, depend on some kind of backend. Thus, an API layer is an integral part of application implementation.
4 |
5 | This six-part series presents tools and approaches that facilitate API layer implementation in Flutter and Dart applications we use at Tide... [Read on Medium](https://medium.com/@foxanna/basic-and-advanced-networking-in-dart-and-flutter-the-tide-way-part-0-introduction-33ac040a4a1c)
6 |
7 | 
8 |
9 | ## Marvel comics
10 |
11 | Find the source code for the Flutter application that displays a list of Marvel comics obtained from [Marvel Comic API](https://developer.marvel.com/) under `marvel_comics` folder.
12 |
13 | 
14 |
--------------------------------------------------------------------------------
/images/cover.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/foxanna/flutter_advanced_networking/3b871e469d5be921e1aede41aa359452dfa230b2/images/cover.png
--------------------------------------------------------------------------------
/images/screenshot1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/foxanna/flutter_advanced_networking/3b871e469d5be921e1aede41aa359452dfa230b2/images/screenshot1.png
--------------------------------------------------------------------------------
/images/screenshot2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/foxanna/flutter_advanced_networking/3b871e469d5be921e1aede41aa359452dfa230b2/images/screenshot2.png
--------------------------------------------------------------------------------
/marvel_comics/.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 |
--------------------------------------------------------------------------------
/marvel_comics/.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 |
25 | # User provided section
26 |
27 | # List of Local paths (relative to this file) that should be
28 | # ignored by the migrate tool.
29 | #
30 | # Files that are not part of the templates will be ignored by default.
31 | unmanaged_files:
32 | - 'lib/main.dart'
33 | - 'ios/Runner.xcodeproj/project.pbxproj'
34 |
--------------------------------------------------------------------------------
/marvel_comics/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | include: package:flutter_lints/flutter.yaml
2 |
3 | analyzer:
4 | exclude:
5 | - '**/*.g.dart'
6 | - '**/*.freezed.dart'
7 |
8 | errors:
9 | invalid_annotation_target: ignore
10 |
--------------------------------------------------------------------------------
/marvel_comics/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 |
--------------------------------------------------------------------------------
/marvel_comics/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | def localProperties = new Properties()
2 | def localPropertiesFile = rootProject.file('local.properties')
3 | if (localPropertiesFile.exists()) {
4 | localPropertiesFile.withReader('UTF-8') { reader ->
5 | localProperties.load(reader)
6 | }
7 | }
8 |
9 | def flutterRoot = localProperties.getProperty('flutter.sdk')
10 | if (flutterRoot == null) {
11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12 | }
13 |
14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15 | if (flutterVersionCode == null) {
16 | flutterVersionCode = '1'
17 | }
18 |
19 | def flutterVersionName = localProperties.getProperty('flutter.versionName')
20 | if (flutterVersionName == null) {
21 | flutterVersionName = '1.0'
22 | }
23 |
24 | apply plugin: 'com.android.application'
25 | apply plugin: 'kotlin-android'
26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
27 |
28 | android {
29 | compileSdkVersion flutter.compileSdkVersion
30 | ndkVersion flutter.ndkVersion
31 |
32 | compileOptions {
33 | sourceCompatibility JavaVersion.VERSION_1_8
34 | targetCompatibility JavaVersion.VERSION_1_8
35 | }
36 |
37 | kotlinOptions {
38 | jvmTarget = '1.8'
39 | }
40 |
41 | sourceSets {
42 | main.java.srcDirs += 'src/main/kotlin'
43 | }
44 |
45 | defaultConfig {
46 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
47 | applicationId "com.example.marvel_comics"
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 |
--------------------------------------------------------------------------------
/marvel_comics/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/marvel_comics/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
7 |
15 |
19 |
23 |
24 |
25 |
26 |
27 |
28 |
30 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/marvel_comics/android/app/src/main/kotlin/com/example/marvel_comics/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.example.marvel_comics
2 |
3 | import io.flutter.embedding.android.FlutterActivity
4 |
5 | class MainActivity: FlutterActivity() {
6 | }
7 |
--------------------------------------------------------------------------------
/marvel_comics/android/app/src/main/res/drawable-v21/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/marvel_comics/android/app/src/main/res/drawable/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/marvel_comics/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/foxanna/flutter_advanced_networking/3b871e469d5be921e1aede41aa359452dfa230b2/marvel_comics/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/marvel_comics/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/foxanna/flutter_advanced_networking/3b871e469d5be921e1aede41aa359452dfa230b2/marvel_comics/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/marvel_comics/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/foxanna/flutter_advanced_networking/3b871e469d5be921e1aede41aa359452dfa230b2/marvel_comics/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/marvel_comics/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/foxanna/flutter_advanced_networking/3b871e469d5be921e1aede41aa359452dfa230b2/marvel_comics/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/marvel_comics/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/foxanna/flutter_advanced_networking/3b871e469d5be921e1aede41aa359452dfa230b2/marvel_comics/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/marvel_comics/android/app/src/main/res/values-night/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/marvel_comics/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/marvel_comics/android/app/src/profile/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/marvel_comics/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 |
--------------------------------------------------------------------------------
/marvel_comics/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 | android.useAndroidX=true
3 | android.enableJetifier=true
4 |
--------------------------------------------------------------------------------
/marvel_comics/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 |
--------------------------------------------------------------------------------
/marvel_comics/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 |
--------------------------------------------------------------------------------
/marvel_comics/build.yaml:
--------------------------------------------------------------------------------
1 | targets:
2 | $default:
3 | builders:
4 | json_serializable:
5 | options:
6 | include_if_null: false
7 | explicit_to_json: true
8 |
--------------------------------------------------------------------------------
/marvel_comics/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 |
--------------------------------------------------------------------------------
/marvel_comics/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 |
--------------------------------------------------------------------------------
/marvel_comics/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/marvel_comics/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/marvel_comics/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 |
--------------------------------------------------------------------------------
/marvel_comics/ios/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - Flutter (1.0.0)
3 | - native_flutter_proxy (0.0.1):
4 | - Flutter
5 |
6 | DEPENDENCIES:
7 | - Flutter (from `Flutter`)
8 | - native_flutter_proxy (from `.symlinks/plugins/native_flutter_proxy/ios`)
9 |
10 | EXTERNAL SOURCES:
11 | Flutter:
12 | :path: Flutter
13 | native_flutter_proxy:
14 | :path: ".symlinks/plugins/native_flutter_proxy/ios"
15 |
16 | SPEC CHECKSUMS:
17 | Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
18 | native_flutter_proxy: 9d5ce4f6db3e1bf1e0c796020393f6500abd3126
19 |
20 | PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3
21 |
22 | COCOAPODS: 1.11.3
23 |
--------------------------------------------------------------------------------
/marvel_comics/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/marvel_comics/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/marvel_comics/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/marvel_comics/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 |
--------------------------------------------------------------------------------
/marvel_comics/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/marvel_comics/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/marvel_comics/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/marvel_comics/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 |
--------------------------------------------------------------------------------
/marvel_comics/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 |
--------------------------------------------------------------------------------
/marvel_comics/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/foxanna/flutter_advanced_networking/3b871e469d5be921e1aede41aa359452dfa230b2/marvel_comics/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
--------------------------------------------------------------------------------
/marvel_comics/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/foxanna/flutter_advanced_networking/3b871e469d5be921e1aede41aa359452dfa230b2/marvel_comics/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
--------------------------------------------------------------------------------
/marvel_comics/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/foxanna/flutter_advanced_networking/3b871e469d5be921e1aede41aa359452dfa230b2/marvel_comics/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
--------------------------------------------------------------------------------
/marvel_comics/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/foxanna/flutter_advanced_networking/3b871e469d5be921e1aede41aa359452dfa230b2/marvel_comics/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
--------------------------------------------------------------------------------
/marvel_comics/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/foxanna/flutter_advanced_networking/3b871e469d5be921e1aede41aa359452dfa230b2/marvel_comics/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
--------------------------------------------------------------------------------
/marvel_comics/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/foxanna/flutter_advanced_networking/3b871e469d5be921e1aede41aa359452dfa230b2/marvel_comics/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
--------------------------------------------------------------------------------
/marvel_comics/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/foxanna/flutter_advanced_networking/3b871e469d5be921e1aede41aa359452dfa230b2/marvel_comics/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
--------------------------------------------------------------------------------
/marvel_comics/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/foxanna/flutter_advanced_networking/3b871e469d5be921e1aede41aa359452dfa230b2/marvel_comics/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
--------------------------------------------------------------------------------
/marvel_comics/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/foxanna/flutter_advanced_networking/3b871e469d5be921e1aede41aa359452dfa230b2/marvel_comics/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
--------------------------------------------------------------------------------
/marvel_comics/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/foxanna/flutter_advanced_networking/3b871e469d5be921e1aede41aa359452dfa230b2/marvel_comics/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
--------------------------------------------------------------------------------
/marvel_comics/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/foxanna/flutter_advanced_networking/3b871e469d5be921e1aede41aa359452dfa230b2/marvel_comics/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
--------------------------------------------------------------------------------
/marvel_comics/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/foxanna/flutter_advanced_networking/3b871e469d5be921e1aede41aa359452dfa230b2/marvel_comics/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
--------------------------------------------------------------------------------
/marvel_comics/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/foxanna/flutter_advanced_networking/3b871e469d5be921e1aede41aa359452dfa230b2/marvel_comics/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
--------------------------------------------------------------------------------
/marvel_comics/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/foxanna/flutter_advanced_networking/3b871e469d5be921e1aede41aa359452dfa230b2/marvel_comics/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
--------------------------------------------------------------------------------
/marvel_comics/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/foxanna/flutter_advanced_networking/3b871e469d5be921e1aede41aa359452dfa230b2/marvel_comics/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
--------------------------------------------------------------------------------
/marvel_comics/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 |
--------------------------------------------------------------------------------
/marvel_comics/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/foxanna/flutter_advanced_networking/3b871e469d5be921e1aede41aa359452dfa230b2/marvel_comics/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/marvel_comics/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/foxanna/flutter_advanced_networking/3b871e469d5be921e1aede41aa359452dfa230b2/marvel_comics/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/marvel_comics/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/foxanna/flutter_advanced_networking/3b871e469d5be921e1aede41aa359452dfa230b2/marvel_comics/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
--------------------------------------------------------------------------------
/marvel_comics/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.
--------------------------------------------------------------------------------
/marvel_comics/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 |
--------------------------------------------------------------------------------
/marvel_comics/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 |
--------------------------------------------------------------------------------
/marvel_comics/ios/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleDisplayName
8 | Marvel Comics
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | marvel_comics
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 |
49 |
50 |
--------------------------------------------------------------------------------
/marvel_comics/ios/Runner/Runner-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | #import "GeneratedPluginRegistrant.h"
2 |
--------------------------------------------------------------------------------
/marvel_comics/lib/domain/api/converter/int_to_string_converter.dart:
--------------------------------------------------------------------------------
1 | import 'package:json_annotation/json_annotation.dart';
2 |
3 | class IntToStringConverter implements JsonConverter {
4 | const IntToStringConverter();
5 |
6 | @override
7 | String fromJson(int json) => '$json';
8 |
9 | @override
10 | int toJson(String object) => int.parse(object);
11 | }
12 |
13 | class NullableIntToNullableStringConverter
14 | implements JsonConverter {
15 | const NullableIntToNullableStringConverter();
16 |
17 | @override
18 | String? fromJson(int? json) => json?.toString();
19 |
20 | @override
21 | int? toJson(String? object) => object != null ? int.parse(object) : null;
22 | }
23 |
--------------------------------------------------------------------------------
/marvel_comics/lib/domain/api/dio/certificates/certificates_management.dart:
--------------------------------------------------------------------------------
1 | import 'dart:io';
2 |
3 | import 'package:marvel_comics/domain/api/dio/certificates/marvel_api_certificate.dart';
4 |
5 | void trustMarvelApiCertificate() {
6 | SecurityContext.defaultContext
7 | .setTrustedCertificatesBytes(marvelApiCertificate);
8 | }
9 |
--------------------------------------------------------------------------------
/marvel_comics/lib/domain/api/dio/dio_factory.dart:
--------------------------------------------------------------------------------
1 | import 'package:dio/adapter.dart';
2 | import 'package:dio/dio.dart';
3 | import 'package:marvel_comics/domain/api/dio/interceptors/append_headers_interceptor.dart';
4 | import 'package:marvel_comics/domain/api/dio/interceptors/marvel_api_auth_interceptor.dart';
5 | import 'package:marvel_comics/domain/api/dio/interceptors/proxy_interceptor.dart';
6 | import 'package:marvel_comics/domain/api/dio/interceptors/secure_action_interceptor.dart';
7 | import 'package:marvel_comics/domain/api/dio/proxy/proxy_finder.dart';
8 |
9 | class DioFactory {
10 | const DioFactory(
11 | this._baseUrl,
12 | this._apiAuthInterceptor,
13 | this._headersInterceptor,
14 | this._secureActionInterceptor,
15 | this._proxyInterceptor,
16 | this._proxyFinder,
17 | );
18 |
19 | final String _baseUrl;
20 | final MarvelApiAuthInterceptor _apiAuthInterceptor;
21 | final ProxyInterceptor _proxyInterceptor;
22 | final ProxyFinder _proxyFinder;
23 | final AppendHeadersInterceptor _headersInterceptor;
24 | final SecureActionInterceptor _secureActionInterceptor;
25 |
26 | Dio create() => Dio(_createBaseOptions())
27 | ..interceptors.addAll([
28 | _apiAuthInterceptor,
29 | _proxyInterceptor,
30 | _headersInterceptor,
31 | _secureActionInterceptor,
32 | ])
33 | ..httpClientAdapter = _createAdapter();
34 |
35 | HttpClientAdapter _createAdapter() => DefaultHttpClientAdapter()
36 | ..onHttpClientCreate =
37 | (client) => client..findProxy = _proxyFinder.findProxy;
38 |
39 | BaseOptions _createBaseOptions() => BaseOptions(
40 | baseUrl: _baseUrl,
41 | receiveTimeout: 15000,
42 | sendTimeout: 15000,
43 | connectTimeout: 5000,
44 | );
45 | }
46 |
--------------------------------------------------------------------------------
/marvel_comics/lib/domain/api/dio/interceptors/append_headers_interceptor.dart:
--------------------------------------------------------------------------------
1 | import 'package:dio/dio.dart';
2 | import 'package:marvel_comics/domain/api/request_annotations.dart';
3 | import 'package:marvel_comics/domain/service/headers_services.dart';
4 |
5 | class AppendHeadersInterceptor extends Interceptor {
6 | AppendHeadersInterceptor(
7 | this._header1Service,
8 | this._header2Service,
9 | this._header3Service,
10 | this._header4Service,
11 | this._header5Service,
12 | );
13 |
14 | final Header1Service _header1Service;
15 | final Header2Service _header2Service;
16 | final Header3Service _header3Service;
17 | final Header4Service _header4Service;
18 | final Header5Service _header5Service;
19 |
20 | @override
21 | Future onRequest(
22 | RequestOptions options, RequestInterceptorHandler handler) async {
23 | if (options.extra[appendHeader1] ?? false) {
24 | options.headers['header-name1'] = _header1Service.header1;
25 | }
26 | options.extra.remove(appendHeader1);
27 |
28 | if (options.extra[appendHeader2] ?? false) {
29 | options.headers['header-name2'] = _header2Service.header2;
30 | }
31 | options.extra.remove(appendHeader2);
32 |
33 | if (options.extra[appendHeader3] ?? false) {
34 | options.headers['header-name3'] = _header3Service.header3;
35 | }
36 | options.extra.remove(appendHeader3);
37 |
38 | if (options.extra[appendHeader4] ?? false) {
39 | options.headers['header-name4'] = _header4Service.header4;
40 | }
41 | options.extra.remove(appendHeader4);
42 |
43 | if (options.extra[appendHeader5] ?? false) {
44 | options.headers['header-name5'] = _header5Service.header5;
45 | }
46 | options.extra.remove(appendHeader5);
47 |
48 | return super.onRequest(options, handler);
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/marvel_comics/lib/domain/api/dio/interceptors/append_timestamp_interceptor.dart:
--------------------------------------------------------------------------------
1 | import 'package:dio/dio.dart';
2 |
3 | class AppendTimestampInterceptor extends Interceptor {
4 | @override
5 | void onRequest(RequestOptions options, RequestInterceptorHandler handler) {
6 | options.queryParameters['ts'] =
7 | DateTime.now().millisecondsSinceEpoch.toString();
8 |
9 | return super.onRequest(options, handler);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/marvel_comics/lib/domain/api/dio/interceptors/example_interceptor.dart:
--------------------------------------------------------------------------------
1 | import 'package:dio/dio.dart';
2 |
3 | class ExampleInterceptor extends Interceptor {
4 | ExampleInterceptor(
5 | this._apiKey,
6 | this._authService,
7 | );
8 |
9 | final String _apiKey;
10 | final AuthService _authService;
11 |
12 | static const _exceptions = ['/login', '/forgot-password'];
13 |
14 | @override
15 | Future onRequest(
16 | RequestOptions options, RequestInterceptorHandler handler) async {
17 | options.headers['api-key'] = _apiKey;
18 |
19 | final timestamp = DateTime.now().millisecondsSinceEpoch.toString();
20 | options.headers['timestamp'] = timestamp;
21 |
22 | if (!_exceptions.any(options.path.startsWith)) {
23 | final accessKey = await _authService.readAccessKey();
24 | options.headers['access-key'] = accessKey;
25 | }
26 |
27 | final appendHeader = options.extra['append-header'] ?? false;
28 | if (appendHeader) {
29 | options.headers['header'] = 'header-value';
30 | }
31 | options.extra.remove('append-header');
32 |
33 | return super.onRequest(options, handler);
34 | }
35 | }
36 |
37 | class AuthService {
38 | Future readAccessKey() => Future.value('token');
39 | }
40 |
--------------------------------------------------------------------------------
/marvel_comics/lib/domain/api/dio/interceptors/marvel_api_auth_interceptor.dart:
--------------------------------------------------------------------------------
1 | import 'package:dio/dio.dart';
2 | import 'package:marvel_comics/domain/api/service/marvel_api_key_service.dart';
3 | import 'package:marvel_comics/utility/hash_utility.dart';
4 |
5 | class MarvelApiAuthInterceptor extends Interceptor {
6 | MarvelApiAuthInterceptor(
7 | this._publicApiKey,
8 | this._apiKeyService,
9 | );
10 |
11 | final String _publicApiKey;
12 | final MarvelApiKeyService _apiKeyService;
13 |
14 | @override
15 | Future onRequest(
16 | RequestOptions options, RequestInterceptorHandler handler) async {
17 | final timestamp = DateTime.now().millisecondsSinceEpoch.toString();
18 | final privateApiKey = await _apiKeyService.getPrivateKey();
19 |
20 | options.queryParameters['ts'] = timestamp;
21 | options.queryParameters['apikey'] = _publicApiKey;
22 | options.queryParameters['hash'] =
23 | md5('$timestamp$privateApiKey$_publicApiKey');
24 |
25 | return super.onRequest(options, handler);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/marvel_comics/lib/domain/api/dio/interceptors/proxy_interceptor.dart:
--------------------------------------------------------------------------------
1 | import 'package:dio/dio.dart';
2 | import 'package:marvel_comics/domain/api/dio/proxy/proxy_holder.dart';
3 | import 'package:marvel_comics/domain/api/dio/proxy/proxy_reader.dart';
4 |
5 | class ProxyInterceptor extends Interceptor {
6 | ProxyInterceptor(this._proxyHolder);
7 |
8 | final ProxyHolder _proxyHolder;
9 |
10 | @override
11 | Future onRequest(
12 | RequestOptions options,
13 | RequestInterceptorHandler handler,
14 | ) async {
15 | final proxySetting = await readProxySetting();
16 | _proxyHolder.set(proxySetting);
17 |
18 | return super.onRequest(options, handler);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/marvel_comics/lib/domain/api/dio/interceptors/secure_action_interceptor.dart:
--------------------------------------------------------------------------------
1 | import 'package:dio/dio.dart';
2 | import 'package:marvel_comics/domain/api/request_annotations.dart';
3 | import 'package:marvel_comics/domain/data/secret_data_repository.dart';
4 |
5 | class SecureActionInterceptor extends Interceptor {
6 | SecureActionInterceptor(
7 | this._secretDataRepository,
8 | );
9 |
10 | final SecretDataRepository _secretDataRepository;
11 |
12 | @override
13 | Future onRequest(
14 | RequestOptions options, RequestInterceptorHandler handler) async {
15 | if (options.headers.containsKey(secureActionHeader)) {
16 | options.headers.remove(secureActionHeader);
17 | final secretData = await _secretDataRepository.getSecretData();
18 | if (secretData != null) {
19 | options.headers['security-header'] = secretData;
20 | } else {
21 | return handler.reject(DioError(requestOptions: options));
22 | }
23 | }
24 |
25 | return super.onRequest(options, handler);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/marvel_comics/lib/domain/api/dio/proxy/proxy_finder.dart:
--------------------------------------------------------------------------------
1 | import 'package:marvel_comics/domain/api/dio/proxy/proxy_holder.dart';
2 |
3 | class ProxyFinder {
4 | const ProxyFinder(this._proxyHolder);
5 |
6 | final ProxyHolder _proxyHolder;
7 |
8 | static const _noProxy = 'DIRECT';
9 |
10 | String findProxy(Uri url) {
11 | final proxySettings = _proxyHolder.get();
12 | return proxySettings != null
13 | ? 'PROXY ${proxySettings.host}:${proxySettings.port}'
14 | : _noProxy;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/marvel_comics/lib/domain/api/dio/proxy/proxy_holder.dart:
--------------------------------------------------------------------------------
1 | import 'package:marvel_comics/domain/api/dio/proxy/proxy_settings.dart';
2 |
3 | class ProxyHolder {
4 | ProxySettings? _settings;
5 |
6 | void set(ProxySettings? settings) => _settings = settings;
7 |
8 | ProxySettings? get() => _settings;
9 | }
10 |
--------------------------------------------------------------------------------
/marvel_comics/lib/domain/api/dio/proxy/proxy_reader.dart:
--------------------------------------------------------------------------------
1 | import 'package:marvel_comics/domain/api/dio/proxy/proxy_settings.dart';
2 | import 'package:native_flutter_proxy/native_proxy_reader.dart';
3 |
4 | Future readProxySetting() async {
5 | try {
6 | final settings = await NativeProxyReader.proxySetting;
7 | return settings.enabled
8 | ? ProxySettings(host: settings.host!, port: settings.port!)
9 | : null;
10 | } catch (_) {
11 | return null;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/marvel_comics/lib/domain/api/dio/proxy/proxy_settings.dart:
--------------------------------------------------------------------------------
1 | class ProxySettings {
2 | const ProxySettings({
3 | required this.host,
4 | required this.port,
5 | });
6 |
7 | final String host;
8 | final int port;
9 | }
10 |
--------------------------------------------------------------------------------
/marvel_comics/lib/domain/api/example_api.dart:
--------------------------------------------------------------------------------
1 | import 'package:dio/dio.dart' hide Headers;
2 | import 'package:marvel_comics/domain/model/marvel_comic.dart';
3 | import 'package:retrofit/retrofit.dart';
4 |
5 | part 'example_api.g.dart';
6 |
7 | const popularHeaders = Headers({
8 | 'header1-name': 'value1',
9 | 'header2-name': 'value2',
10 | });
11 |
12 | const popularHeader = Header('header-name');
13 |
14 | const popularDynamicHeaders = Headers({
15 | 'header1-name': r'$header1Value',
16 | 'header2-name': r'$header2Value',
17 | });
18 |
19 | @RestApi(baseUrl: 'https://example.com')
20 | abstract class ExampleApi {
21 | factory ExampleApi(Dio dio) = _ExampleApi;
22 |
23 | @Extra({'append-header': true})
24 | @Extra({'append-header-duplicate': true})
25 | @GET('/path')
26 | Future request();
27 |
28 | @popularDynamicHeaders
29 | @GET('/get_example')
30 | Future getExample(
31 | String header1Value,
32 | String header2Value,
33 | @popularHeader String headerValue,
34 | );
35 |
36 | @popularHeaders
37 | @POST('/post_example/{id}')
38 | Future postExample(
39 | @Path() String id,
40 | @Body() Map map,
41 | @popularHeader String headerValue,
42 | );
43 |
44 | @popularHeaders
45 | @PUT('/put_example/{id}')
46 | Future