├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── bug.yml │ ├── config.yaml │ ├── feature.yml │ └── infra.yml ├── PULL_REQUEST_TEMPLATE.md ├── dependabot.yaml └── workflows │ ├── check_issues_access.yml │ ├── coverage_base.yml │ ├── coverage_comment.yml │ ├── publish.yml │ └── tests.yml ├── .gitignore ├── .idea └── modules.xml ├── CODEOWNERS ├── CODE_OF_CONDUCT.md ├── COMPATIBILITY_POLICY.md ├── CONTRIBUTING-ZH.md ├── CONTRIBUTING.md ├── LICENSE ├── README-ZH.md ├── README.md ├── SECURITY.md ├── analysis_options.yaml ├── dio ├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── README-ZH.md ├── README.md ├── analysis_options.yaml ├── dart_test.yaml ├── dartdoc_options.yaml ├── dio.iml ├── doc │ ├── migration_guide.md │ └── plugins.md ├── example │ └── dio.dart ├── lib │ ├── browser.dart │ ├── dio.dart │ ├── fix_data │ │ └── fix.yaml │ ├── io.dart │ └── src │ │ ├── adapter.dart │ │ ├── adapters │ │ ├── browser_adapter.dart │ │ └── io_adapter.dart │ │ ├── cancel_token.dart │ │ ├── compute │ │ ├── compute.dart │ │ ├── compute_io.dart │ │ └── compute_web.dart │ │ ├── dio.dart │ │ ├── dio │ │ ├── dio_for_browser.dart │ │ └── dio_for_native.dart │ │ ├── dio_exception.dart │ │ ├── dio_mixin.dart │ │ ├── form_data.dart │ │ ├── headers.dart │ │ ├── interceptor.dart │ │ ├── interceptors │ │ ├── imply_content_type.dart │ │ └── log.dart │ │ ├── multipart_file.dart │ │ ├── multipart_file │ │ ├── browser_multipart_file.dart │ │ └── io_multipart_file.dart │ │ ├── options.dart │ │ ├── parameter.dart │ │ ├── progress_stream │ │ ├── browser_progress_stream.dart │ │ └── io_progress_stream.dart │ │ ├── redirect_record.dart │ │ ├── response.dart │ │ ├── response │ │ └── response_stream_handler.dart │ │ ├── transformer.dart │ │ ├── transformers │ │ ├── background_transformer.dart │ │ ├── fused_transformer.dart │ │ ├── sync_transformer.dart │ │ └── util │ │ │ ├── consolidate_bytes.dart │ │ │ └── transform_empty_to_null.dart │ │ └── utils.dart ├── pubspec.yaml └── test │ ├── adapters_test.dart │ ├── cancel_token_test.dart │ ├── dio_mixin_test.dart │ ├── encoding_test.dart │ ├── exception_test.dart │ ├── formdata_test.dart │ ├── headers_test.dart │ ├── interceptor_test.dart │ ├── mimetype_test.dart │ ├── mock │ ├── _formdata │ ├── _testfile │ ├── adapters.dart │ ├── http_mock.dart │ ├── http_mock.mocks.dart │ └── test.jpg │ ├── multipart_file_test.dart │ ├── options_test.dart │ ├── parameter_test.dart │ ├── pinning_test.dart │ ├── response │ └── response_stream_test.dart │ ├── stacktrace_test.dart │ ├── test_suite_test.dart │ ├── timeout_test.dart │ ├── transformer_test.dart │ └── utils.dart ├── dio_test ├── LICENSE ├── README.md ├── analysis_options.yaml ├── dio_test.iml ├── lib │ ├── src │ │ ├── httpbun.dart │ │ ├── matcher.dart │ │ ├── test │ │ │ ├── basic_tests.dart │ │ │ ├── cancellation_tests.dart │ │ │ ├── cors_tests.dart │ │ │ ├── download_tests.dart │ │ │ ├── headers_tests.dart │ │ │ ├── http_method_tests.dart │ │ │ ├── parameter_tests.dart │ │ │ ├── redirect_tests.dart │ │ │ ├── status_code_tests.dart │ │ │ ├── suite.dart │ │ │ ├── timeout_tests.dart │ │ │ ├── upload_tests.dart │ │ │ └── url_encoded_tests.dart │ │ └── utils.dart │ ├── tests.dart │ └── util.dart └── pubspec.yaml ├── dio_workspace.iml ├── example_dart ├── .gitignore ├── analysis_options.yaml ├── dart_test.yaml ├── dio_example.iml ├── lib │ ├── adapter.dart │ ├── bee.mp4 │ ├── cancel_request.dart │ ├── certificate_pinning.dart │ ├── cookie_mgr.dart │ ├── custom_cache_interceptor.dart │ ├── dio.dart │ ├── download.dart │ ├── download_with_trunks.dart │ ├── extend_dio.dart │ ├── formdata.dart │ ├── generic.dart │ ├── http2_adapter.dart │ ├── options.dart │ ├── post_stream_and_bytes.dart │ ├── proxy.dart │ ├── queue_interceptors.dart │ ├── queued_interceptor_crsftoken.dart │ ├── request_interceptors.dart │ ├── response_interceptor.dart │ ├── test.dart │ ├── transformer.dart │ ├── upload.txt │ └── xx.png └── pubspec.yaml ├── example_flutter_app ├── .gitignore ├── .metadata ├── README.md ├── analysis_options.yaml ├── android │ ├── .gitignore │ ├── app │ │ ├── build.gradle │ │ └── src │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── kotlin │ │ │ └── cn │ │ │ │ └── flutter │ │ │ │ └── dio_flutter_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 │ ├── build.gradle │ ├── dio_flutter_example_android.iml │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ └── settings.gradle ├── dio_flutter_example.iml ├── example_flutter_app.iml ├── ios │ ├── .gitignore │ ├── Flutter │ │ ├── AppFrameworkInfo.plist │ │ ├── Debug.xcconfig │ │ └── Release.xcconfig │ ├── 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 │ └── RunnerTests │ │ └── RunnerTests.swift ├── lib │ ├── http.dart │ ├── main.dart │ └── routes │ │ └── request.dart ├── linux │ ├── .gitignore │ ├── CMakeLists.txt │ ├── flutter │ │ ├── CMakeLists.txt │ │ ├── generated_plugin_registrant.cc │ │ ├── generated_plugin_registrant.h │ │ └── generated_plugins.cmake │ └── runner │ │ ├── CMakeLists.txt │ │ ├── main.cc │ │ ├── my_application.cc │ │ └── my_application.h ├── macos │ ├── .gitignore │ ├── Flutter │ │ ├── Flutter-Debug.xcconfig │ │ ├── Flutter-Release.xcconfig │ │ └── GeneratedPluginRegistrant.swift │ ├── Runner.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ └── xcshareddata │ │ │ │ └── IDEWorkspaceChecks.plist │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ ├── Runner │ │ ├── AppDelegate.swift │ │ ├── Assets.xcassets │ │ │ └── AppIcon.appiconset │ │ │ │ ├── Contents.json │ │ │ │ ├── app_icon_1024.png │ │ │ │ ├── app_icon_128.png │ │ │ │ ├── app_icon_16.png │ │ │ │ ├── app_icon_256.png │ │ │ │ ├── app_icon_32.png │ │ │ │ ├── app_icon_512.png │ │ │ │ └── app_icon_64.png │ │ ├── Base.lproj │ │ │ └── MainMenu.xib │ │ ├── Configs │ │ │ ├── AppInfo.xcconfig │ │ │ ├── Debug.xcconfig │ │ │ ├── Release.xcconfig │ │ │ └── Warnings.xcconfig │ │ ├── DebugProfile.entitlements │ │ ├── Info.plist │ │ ├── MainFlutterWindow.swift │ │ └── Release.entitlements │ └── RunnerTests │ │ └── RunnerTests.swift ├── pubspec.yaml ├── web │ ├── favicon.png │ ├── icons │ │ ├── Icon-192.png │ │ ├── Icon-512.png │ │ ├── Icon-maskable-192.png │ │ └── Icon-maskable-512.png │ ├── index.html │ └── manifest.json └── windows │ ├── .gitignore │ ├── CMakeLists.txt │ ├── flutter │ ├── CMakeLists.txt │ ├── generated_plugin_registrant.cc │ ├── generated_plugin_registrant.h │ └── generated_plugins.cmake │ └── runner │ ├── CMakeLists.txt │ ├── Runner.rc │ ├── flutter_window.cpp │ ├── flutter_window.h │ ├── main.cpp │ ├── resource.h │ ├── resources │ └── app_icon.ico │ ├── runner.exe.manifest │ ├── utils.cpp │ ├── utils.h │ ├── win32_window.cpp │ └── win32_window.h ├── melos.yaml ├── plugins ├── compatibility_layer │ ├── .gitignore │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── analysis_options.yaml │ ├── dart_test.yaml │ ├── dio_compatibility_layer.iml │ ├── example │ │ └── conversion_layer_example.dart │ ├── lib │ │ ├── dio_compatibility_layer.dart │ │ └── src │ │ │ └── conversion_layer_adapter.dart │ ├── pubspec.yaml │ └── test │ │ ├── client_mock.dart │ │ └── conversion_layer_adapter_test.dart ├── cookie_manager │ ├── .gitignore │ ├── .metadata │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── analysis_options.yaml │ ├── dart_test.yaml │ ├── dio_cookie_manager.iml │ ├── example │ │ └── example.dart │ ├── lib │ │ ├── dio_cookie_manager.dart │ │ └── src │ │ │ └── cookie_mgr.dart │ ├── pubspec.yaml │ └── test │ │ ├── basic_test.dart │ │ ├── cookies_persistance_test.dart │ │ └── cookies_test.dart ├── http2_adapter │ ├── .gitignore │ ├── .metadata │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── analysis_options.yaml │ ├── dart_test.yaml │ ├── dio_http2_adapter.iml │ ├── doc │ │ └── migration_guide.md │ ├── example │ │ └── example.dart │ ├── lib │ │ ├── dio_http2_adapter.dart │ │ └── src │ │ │ ├── client_setting.dart │ │ │ ├── connection_manager.dart │ │ │ ├── connection_manager_imp.dart │ │ │ └── http2_adapter.dart │ ├── pubspec.yaml │ └── test │ │ ├── http2_test.dart │ │ ├── pinning_test.dart │ │ ├── redirect_test.dart │ │ └── test_suite_test.dart ├── native_dio_adapter │ ├── .gitignore │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── analysis_options.yaml │ ├── example │ │ ├── .gitignore │ │ ├── analysis_options.yaml │ │ ├── android │ │ │ ├── .gitignore │ │ │ ├── app │ │ │ │ ├── build.gradle │ │ │ │ └── src │ │ │ │ │ ├── debug │ │ │ │ │ └── AndroidManifest.xml │ │ │ │ │ ├── main │ │ │ │ │ ├── AndroidManifest.xml │ │ │ │ │ ├── kotlin │ │ │ │ │ │ └── com │ │ │ │ │ │ │ └── example │ │ │ │ │ │ │ └── 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 │ │ │ └── main.dart │ │ ├── linux │ │ │ ├── .gitignore │ │ │ ├── CMakeLists.txt │ │ │ ├── flutter │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── generated_plugin_registrant.cc │ │ │ │ ├── generated_plugin_registrant.h │ │ │ │ └── generated_plugins.cmake │ │ │ ├── main.cc │ │ │ ├── my_application.cc │ │ │ └── my_application.h │ │ ├── macos │ │ │ ├── .gitignore │ │ │ ├── Flutter │ │ │ │ ├── Flutter-Debug.xcconfig │ │ │ │ ├── Flutter-Release.xcconfig │ │ │ │ └── GeneratedPluginRegistrant.swift │ │ │ ├── Podfile │ │ │ ├── Runner.xcodeproj │ │ │ │ ├── project.pbxproj │ │ │ │ ├── project.xcworkspace │ │ │ │ │ └── xcshareddata │ │ │ │ │ │ └── IDEWorkspaceChecks.plist │ │ │ │ └── xcshareddata │ │ │ │ │ └── xcschemes │ │ │ │ │ └── Runner.xcscheme │ │ │ ├── Runner.xcworkspace │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ └── xcshareddata │ │ │ │ │ └── IDEWorkspaceChecks.plist │ │ │ └── Runner │ │ │ │ ├── AppDelegate.swift │ │ │ │ ├── Assets.xcassets │ │ │ │ └── AppIcon.appiconset │ │ │ │ │ ├── Contents.json │ │ │ │ │ ├── app_icon_1024.png │ │ │ │ │ ├── app_icon_128.png │ │ │ │ │ ├── app_icon_16.png │ │ │ │ │ ├── app_icon_256.png │ │ │ │ │ ├── app_icon_32.png │ │ │ │ │ ├── app_icon_512.png │ │ │ │ │ └── app_icon_64.png │ │ │ │ ├── Base.lproj │ │ │ │ └── MainMenu.xib │ │ │ │ ├── Configs │ │ │ │ ├── AppInfo.xcconfig │ │ │ │ ├── Debug.xcconfig │ │ │ │ ├── Release.xcconfig │ │ │ │ └── Warnings.xcconfig │ │ │ │ ├── DebugProfile.entitlements │ │ │ │ ├── Info.plist │ │ │ │ ├── MainFlutterWindow.swift │ │ │ │ └── Release.entitlements │ │ ├── pubspec.yaml │ │ ├── web │ │ │ ├── favicon.png │ │ │ ├── icons │ │ │ │ ├── Icon-192.png │ │ │ │ ├── Icon-512.png │ │ │ │ ├── Icon-maskable-192.png │ │ │ │ └── Icon-maskable-512.png │ │ │ ├── index.html │ │ │ └── manifest.json │ │ └── windows │ │ │ ├── .gitignore │ │ │ ├── CMakeLists.txt │ │ │ ├── flutter │ │ │ ├── CMakeLists.txt │ │ │ ├── generated_plugin_registrant.cc │ │ │ ├── generated_plugin_registrant.h │ │ │ └── generated_plugins.cmake │ │ │ └── runner │ │ │ ├── CMakeLists.txt │ │ │ ├── Runner.rc │ │ │ ├── flutter_window.cpp │ │ │ ├── flutter_window.h │ │ │ ├── main.cpp │ │ │ ├── resource.h │ │ │ ├── resources │ │ │ └── app_icon.ico │ │ │ ├── runner.exe.manifest │ │ │ ├── utils.cpp │ │ │ ├── utils.h │ │ │ ├── win32_window.cpp │ │ │ └── win32_window.h │ ├── lib │ │ ├── fix_data │ │ │ └── fix.yaml │ │ ├── native_dio_adapter.dart │ │ └── src │ │ │ ├── conversion_layer_adapter.dart │ │ │ ├── cronet_adapter.dart │ │ │ ├── cupertino_adapter.dart │ │ │ └── native_adapter.dart │ ├── native_dio_adapter.iml │ ├── pubspec.yaml │ └── test │ │ ├── client_mock.dart │ │ └── conversion_layer_adapter_test.dart └── web_adapter │ ├── .gitignore │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── analysis_options.yaml │ ├── dart_test.yaml │ ├── dio_web_adapter.iml │ ├── example │ └── main.dart │ ├── lib │ ├── dio_web_adapter.dart │ └── src │ │ ├── adapter.dart │ │ ├── adapter_impl.dart │ │ ├── compute.dart │ │ ├── compute_impl.dart │ │ ├── dio_impl.dart │ │ ├── multipart_file.dart │ │ ├── multipart_file_impl.dart │ │ ├── progress_stream.dart │ │ └── progress_stream_impl.dart │ ├── pubspec.yaml │ └── test │ └── browser_test.dart ├── pubspec.yaml └── scripts ├── melos_packages.dart └── prepare_pinning_certs.sh /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: [AlexV525, kuhnroyal] 2 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yaml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: true -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature.yml: -------------------------------------------------------------------------------- 1 | name: 💡 Feature Request 2 | description: Tell us about a problem dio could solve but doesn't. 3 | labels: ["s: feature"] 4 | body: 5 | - type: textarea 6 | id: problem 7 | attributes: 8 | label: Request Statement 9 | description: What problem could dio solve that it doesn't? 10 | validations: 11 | required: true 12 | - type: textarea 13 | id: expected 14 | attributes: 15 | label: Solution Brainstorm 16 | description: We know you have bright ideas to share ... share away, friend. 17 | validations: 18 | required: false 19 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/infra.yml: -------------------------------------------------------------------------------- 1 | name: 👷 Infra 2 | description: Something is wrong with the CI setup or could be improved 3 | labels: ["infra"] 4 | body: 5 | - type: textarea 6 | id: problem 7 | attributes: 8 | label: Request Statement 9 | validations: 10 | required: true 11 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ### New Pull Request Checklist 4 | 5 | - [ ] I have read the [Documentation](https://pub.dev/documentation/dio/latest/) 6 | - [ ] I have searched for a similar pull request in the [project](https://github.com/cfug/dio/pulls) and found none 7 | - [ ] I have updated this branch with the latest `main` branch to avoid conflicts (via merge from master or rebase) 8 | - [ ] I have added the required tests to prove the fix/feature I'm adding 9 | - [ ] I have updated the documentation (if necessary) 10 | - [ ] I have run the tests without failures 11 | - [ ] I have updated the `CHANGELOG.md` in the corresponding package 12 | 13 | ### Additional context and info (if any) 14 | 15 | 16 | -------------------------------------------------------------------------------- /.github/dependabot.yaml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "github-actions" 4 | directory: "/" 5 | schedule: 6 | interval: "weekly" 7 | labels: 8 | - "infra" 9 | - "github-actions" 10 | -------------------------------------------------------------------------------- /.github/workflows/coverage_comment.yml: -------------------------------------------------------------------------------- 1 | name: 'coverage_comment' 2 | 3 | # This workflow runs after the 'Verify packages abilities' workflow is completed for a pull request. 4 | # The workflow downloads the coverage report if the 'Verify packages abilities' workflow was successful. 5 | # The workflow then adds a comment to the PR with the coverage report. 6 | 7 | on: 8 | workflow_run: 9 | workflows: ['Verify packages abilities'] 10 | types: 11 | - completed 12 | 13 | jobs: 14 | download_coverage: 15 | runs-on: ubuntu-latest 16 | if: github.event.workflow_run.event == 'pull_request' 17 | steps: 18 | - name: Download artifact 19 | id: download-artifact 20 | uses: dawidd6/action-download-artifact@v9 21 | with: 22 | workflow: tests.yml 23 | workflow_conclusion: success 24 | run_id: ${{ github.event.workflow_run.id }} 25 | name: code-coverage-results 26 | - name: Determine PR number 27 | id: pr-number 28 | run: | 29 | PR_NUMBER=$(cat pr_number.txt) 30 | echo "Found PR:$PR_NUMBER" 31 | echo "value=$PR_NUMBER" >> $GITHUB_OUTPUT 32 | - name: Add PR comment 33 | uses: marocchino/sticky-pull-request-comment@v2 34 | with: 35 | number: ${{ steps.pr-number.outputs.value }} 36 | recreate: true 37 | path: code-coverage-results.md 38 | -------------------------------------------------------------------------------- /.github/workflows/publish.yml: -------------------------------------------------------------------------------- 1 | name: Publish from comments 2 | 3 | on: 4 | issue_comment: 5 | types: [created] 6 | 7 | jobs: 8 | publish: 9 | # https://github.com/cfug/dio/issues/1633 10 | if: github.event.issue.number == 1633 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v4 14 | with: 15 | token: ${{ secrets.CFUG_PUBLISHER }} 16 | - uses: dart-lang/setup-dart@v1.4 17 | - uses: cfug/dio_issue_release_action@v2 18 | with: 19 | github-token: ${{ secrets.CFUG_PUBLISHER }} 20 | pub-credentials-json: ${{ secrets.CREDENTIAL_JSON }} 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Files and directories created by pub 2 | .packages 3 | .dart_tool/ 4 | .pub/ 5 | .example/flutter.png 6 | build/ 7 | # Remove the following pattern if you wish to check in your lock file 8 | pubspec.lock 9 | pubspec_overrides.yaml 10 | 11 | # Directory created by dartdoc 12 | doc/api/ 13 | .cookies/ 14 | 15 | .vscode/ 16 | 17 | # Miscellaneous 18 | .DS_Store 19 | 20 | # IDEA configurations 21 | /.idea/* 22 | !/.idea/dio.iml 23 | !/.idea/modules.xml 24 | 25 | # Coverage 26 | coverage 27 | 28 | # Melos 29 | **/.melos_package 30 | .melos_packages 31 | melos_overrides.yaml 32 | 33 | # FVM Version Cache 34 | .fvm/ 35 | .fvmrc 36 | -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @cfug/dio-core 2 | -------------------------------------------------------------------------------- /COMPATIBILITY_POLICY.md: -------------------------------------------------------------------------------- 1 | # Compatibility Policy 2 | 3 | As an open-source project, all activities happened when the maintainers have spare time and energy. 4 | The support range is limited due to the above condition. 5 | Therefore, we have a general compatibility policy to help people 6 | that are not actively adapting SDK updates or intended to use any old SDKs to acknowledge the support range. 7 | 8 | ## Policy Details 9 | 10 | For all packages, the oldest Dart SDK we typically support 11 | is one that was **released less than 2 years ago**. 12 | 13 | ### Exceptions 14 | 15 | - The minimum SDK version will follow the dependencies' requirement. 16 | For example: `http2: ^2.1.0` requires Dart SDK >=3.0.0. 17 | - The implementation can no longer compatible between the latest and previous SDKs. 18 | - Previous SDKs have security issues that require to use a new version. 19 | 20 | To raise your suggestions and reports, use the issue tracker 21 | or contact cfug-team@googlegroups.com if you want to do this privately. 22 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Wen Du (wendux) 4 | Copyright (c) 2022 The CFUG Team 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Supported Versions 4 | 5 | | Version | Supported | 6 | |---------|-----------| 7 | | >=5.0 | ✅ | 8 | | < 5.0 | ❌ | 9 | 10 | ## Reporting a Vulnerability 11 | 12 | Contact cfug-team@googlegroups.com with your vulnerability report. 13 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:lints/recommended.yaml 2 | 3 | analyzer: 4 | errors: 5 | always_declare_return_types: error 6 | always_put_control_body_on_new_line: error 7 | avoid_renaming_method_parameters: error 8 | avoid_void_async: error 9 | camel_case_types: error 10 | constant_identifier_names: error 11 | deprecated_member_use_from_same_package: ignore 12 | non_constant_identifier_names: error 13 | prefer_single_quotes: error 14 | require_trailing_commas: error 15 | todo: ignore 16 | 17 | linter: 18 | rules: 19 | always_declare_return_types: true 20 | always_put_control_body_on_new_line: true 21 | avoid_renaming_method_parameters: true 22 | avoid_unnecessary_containers: true 23 | avoid_void_async: true 24 | curly_braces_in_flow_control_structures: true 25 | directives_ordering: true 26 | library_annotations: false 27 | prefer_const_constructors: true 28 | prefer_const_constructors_in_immutables: false 29 | prefer_final_fields: true 30 | prefer_final_in_for_each: true 31 | prefer_final_locals: true 32 | prefer_relative_imports: true 33 | prefer_single_quotes: true 34 | require_trailing_commas: true 35 | sort_constructors_first: true 36 | sort_unnamed_constructors_first: true 37 | unnecessary_await_in_return: true 38 | unnecessary_breaks: true 39 | unnecessary_late: true 40 | unnecessary_library_name: false 41 | unnecessary_parenthesis: true 42 | -------------------------------------------------------------------------------- /dio/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.ipr 14 | *.iws 15 | .idea/ 16 | 17 | # The .vscode folder contains launch configuration and tasks you configure in 18 | # VS Code which you may wish to be included in version control, so this line 19 | # is commented out by default. 20 | #.vscode/ 21 | 22 | # Flutter/Dart/Pub related 23 | **/doc/api/ 24 | .dart_tool/ 25 | .flutter-plugins 26 | .packages 27 | .pub-cache/ 28 | .pub/ 29 | build/ 30 | 31 | # Exceptions to above rules. 32 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 33 | 34 | # Project related. 35 | test/*_pinning.txt 36 | 37 | coverage 38 | -------------------------------------------------------------------------------- /dio/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Wen Du (wendux) 4 | Copyright (c) 2022 The CFUG Team 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. -------------------------------------------------------------------------------- /dio/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: ../analysis_options.yaml 2 | -------------------------------------------------------------------------------- /dio/dart_test.yaml: -------------------------------------------------------------------------------- 1 | file_reporters: 2 | json: build/reports/test-results.json 3 | 4 | presets: 5 | # empty placeholders required in CI scripts 6 | all: 7 | default: 8 | min: 9 | stable: 10 | beta: 11 | 12 | tags: 13 | tls: 14 | skip: "Skipping TLS test with specific setup requirements by default. Use '-P all' to run all tests." 15 | presets: 16 | all: 17 | skip: false 18 | default: 19 | skip: true 20 | gc: # We have that tag, but we are not skipping in any preset. 21 | 22 | override_platforms: 23 | chrome: 24 | settings: 25 | headless: true 26 | firefox: 27 | settings: 28 | # headless argument has to be set explicitly for non-chrome browsers 29 | arguments: --headless 30 | executable: 31 | # https://github.com/dart-lang/test/pull/2195 32 | mac_os: '/Applications/Firefox.app/Contents/MacOS/firefox' 33 | -------------------------------------------------------------------------------- /dio/dartdoc_options.yaml: -------------------------------------------------------------------------------- 1 | dartdoc: 2 | showUndocumentedCategories: true 3 | categories: 4 | "Migration Guide": 5 | markdown: doc/migration_guide.md 6 | "Plugins": 7 | markdown: doc/plugins.md 8 | -------------------------------------------------------------------------------- /dio/dio.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /dio/example/dio.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | 3 | /// More examples see https://github.com/cfug/dio/tree/main/dio#examples 4 | void main() async { 5 | final dio = Dio(); 6 | final response = await dio.get('https://pub.dev'); 7 | print(response.data); 8 | } 9 | -------------------------------------------------------------------------------- /dio/lib/browser.dart: -------------------------------------------------------------------------------- 1 | export 'src/adapters/browser_adapter.dart' show BrowserHttpClientAdapter; 2 | export 'src/dio/dio_for_browser.dart' show DioForBrowser; 3 | -------------------------------------------------------------------------------- /dio/lib/dio.dart: -------------------------------------------------------------------------------- 1 | /// A powerful HTTP client for Dart and Flutter, which supports global settings, 2 | /// [Interceptors], [FormData], aborting and canceling a request, 3 | /// files uploading and downloading, requests timeout, custom adapters, etc. 4 | /// {@category Migration Guide} 5 | /// {@category Plugins} 6 | library dio; 7 | 8 | export 'src/adapter.dart'; 9 | export 'src/cancel_token.dart'; 10 | export 'src/dio.dart'; 11 | export 'src/dio_exception.dart'; 12 | export 'src/dio_mixin.dart' hide InterceptorState, InterceptorResultType; 13 | export 'src/form_data.dart'; 14 | export 'src/headers.dart'; 15 | export 'src/interceptors/log.dart'; 16 | export 'src/multipart_file.dart'; 17 | export 'src/options.dart'; 18 | export 'src/parameter.dart'; 19 | export 'src/redirect_record.dart'; 20 | export 'src/response.dart'; 21 | export 'src/transformer.dart'; 22 | -------------------------------------------------------------------------------- /dio/lib/io.dart: -------------------------------------------------------------------------------- 1 | export 'src/adapters/io_adapter.dart' hide createAdapter; 2 | export 'src/dio/dio_for_native.dart' show DioForNative; 3 | -------------------------------------------------------------------------------- /dio/lib/src/adapters/browser_adapter.dart: -------------------------------------------------------------------------------- 1 | export 'package:dio_web_adapter/dio_web_adapter.dart' 2 | show createAdapter, BrowserHttpClientAdapter; 3 | -------------------------------------------------------------------------------- /dio/lib/src/compute/compute_web.dart: -------------------------------------------------------------------------------- 1 | export 'package:dio_web_adapter/dio_web_adapter.dart' show compute; 2 | -------------------------------------------------------------------------------- /dio/lib/src/dio/dio_for_browser.dart: -------------------------------------------------------------------------------- 1 | export 'package:dio_web_adapter/dio_web_adapter.dart' 2 | show createDio, DioForBrowser; 3 | -------------------------------------------------------------------------------- /dio/lib/src/interceptors/imply_content_type.dart: -------------------------------------------------------------------------------- 1 | import '../dio_mixin.dart'; 2 | import '../form_data.dart'; 3 | import '../headers.dart'; 4 | import '../options.dart'; 5 | import '../utils.dart'; 6 | 7 | /// {@template dio.interceptors.ImplyContentTypeInterceptor} 8 | /// The default `content-type` for requests will be implied by the 9 | /// [ImplyContentTypeInterceptor] according to the type of the request payload. 10 | /// The interceptor can be removed by 11 | /// [Interceptors.removeImplyContentTypeInterceptor]. 12 | /// {@endtemplate} 13 | class ImplyContentTypeInterceptor extends Interceptor { 14 | const ImplyContentTypeInterceptor(); 15 | 16 | @override 17 | void onRequest( 18 | RequestOptions options, 19 | RequestInterceptorHandler handler, 20 | ) { 21 | final Object? data = options.data; 22 | if (data != null && options.contentType == null) { 23 | final String? contentType; 24 | if (data is FormData) { 25 | contentType = Headers.multipartFormDataContentType; 26 | } else if (data is List || data is Map || data is String) { 27 | contentType = Headers.jsonContentType; 28 | } else { 29 | warningLog( 30 | '${data.runtimeType} cannot be used ' 31 | 'to imply a default content-type, ' 32 | 'please set a proper content-type in the request.', 33 | StackTrace.current, 34 | ); 35 | contentType = null; 36 | } 37 | options.contentType = contentType; 38 | } 39 | handler.next(options); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /dio/lib/src/multipart_file/browser_multipart_file.dart: -------------------------------------------------------------------------------- 1 | export 'package:dio_web_adapter/dio_web_adapter.dart' 2 | show multipartFileFromPath, multipartFileFromPathSync; 3 | -------------------------------------------------------------------------------- /dio/lib/src/multipart_file/io_multipart_file.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:io'; 3 | 4 | import 'package:path/path.dart' as p; 5 | 6 | import '../multipart_file.dart'; 7 | 8 | Future multipartFileFromPath( 9 | String filePath, { 10 | String? filename, 11 | DioMediaType? contentType, 12 | final Map>? headers, 13 | }) async { 14 | filename ??= p.basename(filePath); 15 | final file = File(filePath); 16 | final length = await file.length(); 17 | return MultipartFile.fromStream( 18 | () => _getStreamFromFilepath(file), 19 | length, 20 | filename: filename, 21 | contentType: contentType, 22 | headers: headers, 23 | ); 24 | } 25 | 26 | MultipartFile multipartFileFromPathSync( 27 | String filePath, { 28 | String? filename, 29 | DioMediaType? contentType, 30 | final Map>? headers, 31 | }) { 32 | filename ??= p.basename(filePath); 33 | final file = File(filePath); 34 | final length = file.lengthSync(); 35 | return MultipartFile.fromStream( 36 | () => _getStreamFromFilepath(file), 37 | length, 38 | filename: filename, 39 | contentType: contentType, 40 | headers: headers, 41 | ); 42 | } 43 | 44 | Stream> _getStreamFromFilepath(File file) { 45 | final stream = file.openRead(); 46 | return stream; 47 | } 48 | -------------------------------------------------------------------------------- /dio/lib/src/parameter.dart: -------------------------------------------------------------------------------- 1 | import 'package:collection/collection.dart'; 2 | 3 | import 'options.dart'; 4 | 5 | /// Indicates a param being used as queries or form data, 6 | /// and how does it gets formatted. 7 | class ListParam { 8 | const ListParam(this.value, this.format); 9 | 10 | /// The value used in queries or in form data. 11 | final List value; 12 | 13 | /// How does the value gets formatted. 14 | final ListFormat format; 15 | 16 | /// Generate a new [ListParam] by copying fields. 17 | ListParam copyWith({List? value, ListFormat? format}) { 18 | return ListParam(value ?? this.value, format ?? this.format); 19 | } 20 | 21 | @override 22 | String toString() { 23 | return 'ListParam{value: $value, format: $format}'; 24 | } 25 | 26 | @override 27 | bool operator ==(Object other) => 28 | identical(this, other) || 29 | other is ListParam && 30 | runtimeType == other.runtimeType && 31 | const DeepCollectionEquality().equals(value, other.value) && 32 | format == other.format; 33 | 34 | @override 35 | int get hashCode => Object.hash( 36 | const DeepCollectionEquality().hash(value), 37 | format, 38 | ); 39 | } 40 | -------------------------------------------------------------------------------- /dio/lib/src/progress_stream/browser_progress_stream.dart: -------------------------------------------------------------------------------- 1 | export 'package:dio_web_adapter/dio_web_adapter.dart' show addProgress; 2 | -------------------------------------------------------------------------------- /dio/lib/src/progress_stream/io_progress_stream.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:typed_data'; 3 | 4 | import '../options.dart'; 5 | 6 | Stream addProgress( 7 | Stream> stream, 8 | int? length, 9 | RequestOptions options, 10 | ) { 11 | final streamTransformer = stream is Stream 12 | ? _transform(stream, length, options) 13 | : _transform>(stream, length, options); 14 | return stream.transform(streamTransformer); 15 | } 16 | 17 | StreamTransformer _transform>( 18 | Stream stream, 19 | int? length, 20 | RequestOptions options, 21 | ) { 22 | int complete = 0; 23 | return StreamTransformer.fromHandlers( 24 | handleData: (S data, sink) { 25 | final cancelToken = options.cancelToken; 26 | if (cancelToken != null && cancelToken.isCancelled) { 27 | cancelToken.requestOptions = options; 28 | sink 29 | ..addError(cancelToken.cancelError!) 30 | ..close(); 31 | } else { 32 | if (data is Uint8List) { 33 | sink.add(data); 34 | } else { 35 | sink.add(Uint8List.fromList(data)); 36 | } 37 | if (length != null) { 38 | complete += data.length; 39 | if (options.onSendProgress != null) { 40 | options.onSendProgress!(complete, length); 41 | } 42 | } 43 | } 44 | }, 45 | ); 46 | } 47 | -------------------------------------------------------------------------------- /dio/lib/src/redirect_record.dart: -------------------------------------------------------------------------------- 1 | /// A record that records the redirection happens during requests, 2 | /// including status code, request method, and the location. 3 | class RedirectRecord { 4 | const RedirectRecord(this.statusCode, this.method, this.location); 5 | 6 | /// Returns the status code used for the redirect. 7 | final int statusCode; 8 | 9 | /// Returns the method used for the redirect. 10 | final String method; 11 | 12 | /// Returns the location for the redirect. 13 | final Uri location; 14 | 15 | @override 16 | String toString() { 17 | return 'RedirectRecord' 18 | '{statusCode: $statusCode, method: $method, location: $location}'; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /dio/lib/src/transformers/background_transformer.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:convert'; 3 | 4 | import '../compute/compute.dart'; 5 | import '../transformers/sync_transformer.dart'; 6 | 7 | /// The default [Transformer] for [Dio]. 8 | /// 9 | /// [BackgroundTransformer] will do the deserialization of JSON in 10 | /// a background isolate if possible. 11 | class BackgroundTransformer extends SyncTransformer { 12 | BackgroundTransformer() : super(jsonDecodeCallback: _decodeJson); 13 | } 14 | 15 | FutureOr _decodeJson(String text) { 16 | // Taken from https://github.com/flutter/flutter/blob/135454af32477f815a7525073027a3ff9eff1bfd/packages/flutter/lib/src/services/asset_bundle.dart#L87-L93 17 | // 50 KB of data should take 2-3 ms to parse on a Moto G4, and about 400 μs 18 | // on a Pixel 4. 19 | if (text.codeUnits.length < 50 * 1024) { 20 | return jsonDecode(text); 21 | } 22 | // For strings larger than 50 KB, run the computation in an isolate to 23 | // avoid causing main thread jank. 24 | return compute(jsonDecode, text); 25 | } 26 | -------------------------------------------------------------------------------- /dio/lib/src/transformers/util/consolidate_bytes.dart: -------------------------------------------------------------------------------- 1 | import 'dart:typed_data'; 2 | 3 | /// Consolidates a stream of [Uint8List] into a single [Uint8List] 4 | Future consolidateBytes(Stream stream) async { 5 | final builder = BytesBuilder(copy: false); 6 | 7 | await for (final chunk in stream) { 8 | builder.add(chunk); 9 | } 10 | 11 | return builder.takeBytes(); 12 | } 13 | -------------------------------------------------------------------------------- /dio/lib/src/transformers/util/transform_empty_to_null.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:typed_data'; 3 | 4 | /// A [StreamTransformer] that replaces an empty stream of Uint8List with a default value 5 | /// - the utf8-encoded string "null". 6 | /// Feeding an empty stream to a JSON decoder will throw an exception, so this transformer 7 | /// is used to prevent that; the JSON decoder will instead return null. 8 | class DefaultNullIfEmptyStreamTransformer 9 | extends StreamTransformerBase { 10 | const DefaultNullIfEmptyStreamTransformer(); 11 | 12 | @override 13 | Stream bind(Stream stream) { 14 | return Stream.eventTransformed( 15 | stream, 16 | (sink) => _DefaultIfEmptyStreamSink(sink), 17 | ); 18 | } 19 | } 20 | 21 | class _DefaultIfEmptyStreamSink implements EventSink { 22 | _DefaultIfEmptyStreamSink(this._outputSink); 23 | 24 | /// Hard-coded constant for replacement value, "null" 25 | static final Uint8List _nullUtf8Value = 26 | Uint8List.fromList(const [110, 117, 108, 108]); 27 | 28 | final EventSink _outputSink; 29 | bool _hasData = false; 30 | 31 | @override 32 | void add(Uint8List data) { 33 | _hasData = _hasData || data.isNotEmpty; 34 | _outputSink.add(data); 35 | } 36 | 37 | @override 38 | void addError(e, [st]) => _outputSink.addError(e, st); 39 | 40 | @override 41 | void close() { 42 | if (!_hasData) { 43 | _outputSink.add(_nullUtf8Value); 44 | } 45 | 46 | _outputSink.close(); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /dio/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: dio 2 | version: 5.8.0+1 3 | 4 | description: | 5 | A powerful HTTP networking package, 6 | supports Interceptors, 7 | Aborting and canceling a request, 8 | Custom adapters, Transformers, etc. 9 | topics: 10 | - dio 11 | - http 12 | - network 13 | - interceptor 14 | - middleware 15 | homepage: https://github.com/cfug/dio 16 | repository: https://github.com/cfug/dio/blob/main/dio 17 | issue_tracker: https://github.com/cfug/dio/issues 18 | 19 | environment: 20 | sdk: '>=2.18.0 <4.0.0' 21 | 22 | dependencies: 23 | async: ^2.8.2 24 | collection: ^1.16.0 25 | http_parser: ^4.0.0 26 | meta: ^1.5.0 27 | path: ^1.8.0 28 | 29 | dio_web_adapter: '>=1.1.0 <3.0.0' 30 | 31 | dev_dependencies: 32 | lints: any 33 | test: ^1.5.1 34 | build_runner: any 35 | coverage: ^1.0.3 36 | crypto: ^3.0.2 37 | mockito: ^5.2.0 38 | 39 | # Shared test package. 40 | dio_test: 41 | git: 42 | url: https://github.com/cfug/dio 43 | path: dio_test 44 | -------------------------------------------------------------------------------- /dio/test/adapters_test.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:dio/dio.dart'; 4 | import 'package:dio/io.dart'; 5 | import 'package:test/test.dart'; 6 | 7 | void main() { 8 | group( 9 | IOHttpClientAdapter, 10 | () { 11 | test('onHttpClientCreate is only executed once per request', () async { 12 | int onHttpClientCreateInvokeCount = 0; 13 | final dio = Dio(); 14 | dio.httpClientAdapter = IOHttpClientAdapter( 15 | // ignore: deprecated_member_use_from_same_package 16 | onHttpClientCreate: (client) { 17 | onHttpClientCreateInvokeCount++; 18 | return client; 19 | }, 20 | ); 21 | await dio.get('https://pub.dev'); 22 | expect(onHttpClientCreateInvokeCount, 1); 23 | }); 24 | 25 | test('createHttpClientCount is only executed once per request', () async { 26 | int createHttpClientCount = 0; 27 | final dio = Dio(); 28 | dio.httpClientAdapter = IOHttpClientAdapter( 29 | createHttpClient: () { 30 | createHttpClientCount++; 31 | return HttpClient(); 32 | }, 33 | ); 34 | await dio.get('https://pub.dev'); 35 | expect(createHttpClientCount, 1); 36 | }); 37 | }, 38 | testOn: 'vm', 39 | ); 40 | } 41 | -------------------------------------------------------------------------------- /dio/test/mimetype_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | import 'package:test/test.dart'; 3 | 4 | void main() { 5 | test('application/json', () { 6 | expect(Transformer.isJsonMimeType('application/json'), isTrue); 7 | }); 8 | 9 | test('text/json', () { 10 | expect(Transformer.isJsonMimeType('text/json'), isTrue); 11 | }); 12 | 13 | test('application/vnd.example.com+json', () { 14 | expect( 15 | Transformer.isJsonMimeType('application/vnd.example.com+json'), 16 | isTrue, 17 | ); 18 | }); 19 | } 20 | -------------------------------------------------------------------------------- /dio/test/mock/_formdata: -------------------------------------------------------------------------------- 1 | ----dio-boundary-3788753558 2 | content-disposition: form-data; name="name" 3 | 4 | wendux 5 | ----dio-boundary-3788753558 6 | content-disposition: form-data; name="age" 7 | 8 | 25 9 | ----dio-boundary-3788753558 10 | content-disposition: form-data; name="path" 11 | 12 | /图片空间/地址 13 | ----dio-boundary-3788753558 14 | content-disposition: form-data; name="file" 15 | content-type: text/plain; charset=utf-8 16 | test: a 17 | 18 | hello world. 19 | ----dio-boundary-3788753558 20 | content-disposition: form-data; name="files"; filename="1.txt" 21 | content-type: application/octet-stream 22 | test: b 23 | 24 | 你好世界, 25 | 我很好人类 26 | 哈哈哈哈哈😆 27 | 28 | ----dio-boundary-3788753558 29 | content-disposition: form-data; name="files"; filename="2.txt" 30 | content-type: text/plain 31 | test: c 32 | 33 | 你好世界, 34 | 我很好人类 35 | 哈哈哈哈哈😆 36 | 37 | ----dio-boundary-3788753558 38 | content-disposition: form-data; name="files"; filename="3.txt" 39 | content-type: text/plain 40 | test: d 41 | 42 | hello world again. 43 | ----dio-boundary-3788753558-- 44 | -------------------------------------------------------------------------------- /dio/test/mock/_testfile: -------------------------------------------------------------------------------- 1 | 你好世界, 2 | 我很好人类 3 | 哈哈哈哈哈😆 4 | -------------------------------------------------------------------------------- /dio/test/mock/http_mock.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:dio/dio.dart'; 4 | import 'package:mockito/annotations.dart'; 5 | 6 | import 'http_mock.mocks.dart'; 7 | 8 | final httpClientMock = MockHttpClient(); 9 | 10 | @GenerateMocks( 11 | [], 12 | customMocks: [ 13 | MockSpec(), 14 | MockSpec(), 15 | MockSpec(), 16 | MockSpec(), 17 | MockSpec(), 18 | ], 19 | ) 20 | class MockHttpOverrides extends HttpOverrides { 21 | @override 22 | HttpClient createHttpClient(SecurityContext? context) { 23 | return httpClientMock; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /dio/test/mock/test.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/dio/test/mock/test.jpg -------------------------------------------------------------------------------- /dio/test/parameter_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | import 'package:test/test.dart'; 3 | 4 | void main() { 5 | group('ListParam', () { 6 | test('param1 and param2 should be considered equal', () { 7 | final param1 = const ListParam(['item1', 'item2'], ListFormat.csv); 8 | final param2 = const ListParam(['item1', 'item2'], ListFormat.csv); 9 | expect(param1 == param2, isTrue); 10 | }); 11 | 12 | test('param1 and param3 should not be considered equal', () { 13 | final param1 = const ListParam(['item1', 'item2'], ListFormat.csv); 14 | final param3 = const ListParam(['item3', 'item4'], ListFormat.csv); 15 | expect(param1 == param3, isFalse); 16 | }); 17 | 18 | test('Order matters: param1 and param4 should not be equal', () { 19 | final param1 = const ListParam(['item1', 'item2'], ListFormat.csv); 20 | final param4 = const ListParam(['item2', 'item1'], ListFormat.csv); 21 | expect(param1 == param4, isFalse); 22 | }); 23 | }); 24 | } 25 | -------------------------------------------------------------------------------- /dio/test/test_suite_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | import 'package:dio_test/tests.dart'; 3 | 4 | void main() { 5 | dioAdapterTestSuite( 6 | (baseUrl) => Dio(BaseOptions(baseUrl: baseUrl)), 7 | ); 8 | } 9 | -------------------------------------------------------------------------------- /dio/test/timeout_test.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:dio/dio.dart'; 4 | import 'package:dio/io.dart'; 5 | import 'package:dio_test/util.dart'; 6 | import 'package:test/test.dart'; 7 | 8 | void main() { 9 | late Dio dio; 10 | 11 | setUp(() { 12 | dio = Dio(); 13 | dio.options.baseUrl = httpbunBaseUrl; 14 | }); 15 | 16 | group('Timeout exception of', () { 17 | group('connectTimeout', () { 18 | test( 19 | 'update between calls', 20 | () async { 21 | final client = HttpClient(); 22 | final dio = Dio() 23 | ..options.baseUrl = nonRoutableUrl 24 | ..httpClientAdapter = IOHttpClientAdapter( 25 | createHttpClient: () => client, 26 | ); 27 | 28 | dio.options.connectTimeout = const Duration(milliseconds: 5); 29 | await dio 30 | .get('/') 31 | .catchError((e) => Response(requestOptions: RequestOptions())); 32 | expect(client.connectionTimeout, dio.options.connectTimeout); 33 | dio.options.connectTimeout = const Duration(milliseconds: 10); 34 | await dio 35 | .get('/') 36 | .catchError((e) => Response(requestOptions: RequestOptions())); 37 | expect(client.connectionTimeout, dio.options.connectTimeout); 38 | }, 39 | testOn: 'vm', 40 | ); 41 | }); 42 | }); 43 | } 44 | -------------------------------------------------------------------------------- /dio_test/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 The CFUG Team 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 | -------------------------------------------------------------------------------- /dio_test/README.md: -------------------------------------------------------------------------------- 1 | # Dio shared test package 2 | 3 | The package gathered shared tests between Dio's packages, 4 | such as `dio` and `http2_adapter`. 5 | 6 | The package was meant to not be published to pub.dev. 7 | To use the package in tests, make the library depend like this: 8 | 9 | ```yaml 10 | dev_dependencies: 11 | # Shared test package. 12 | dio_test: 13 | git: 14 | url: https://github.com/cfug/dio 15 | path: dio_test 16 | ``` 17 | 18 | Then, use `dependency_overrides` or `pubspec_overrides.yaml` 19 | to override the package to a local path or somewhere else. 20 | 21 | ## Copyright & License 22 | 23 | The project is authored by 24 | [Chinese Flutter User Group (@cfug)](https://github.com/cfug) 25 | since 2024. 26 | 27 | The project consents [the MIT license](LICENSE). 28 | -------------------------------------------------------------------------------- /dio_test/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: ../analysis_options.yaml 2 | 3 | linter: 4 | rules: 5 | depend_on_referenced_packages: false 6 | -------------------------------------------------------------------------------- /dio_test/dio_test.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /dio_test/lib/src/httpbun.dart: -------------------------------------------------------------------------------- 1 | const httpbunBaseUrl = 'https://httpbun.com'; 2 | -------------------------------------------------------------------------------- /dio_test/lib/src/matcher.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | import 'package:test/test.dart'; 3 | 4 | /// A matcher for functions that throw [DioException] of a specified type, 5 | /// with an optional matcher for the stackTrace containing the specified text. 6 | Matcher throwsDioException( 7 | DioExceptionType type, { 8 | String? messageContains, 9 | String? stackTraceContains, 10 | Object? matcher, 11 | }) => 12 | throwsA( 13 | matchesDioException( 14 | type, 15 | messageContains: messageContains, 16 | stackTraceContains: stackTraceContains, 17 | matcher: matcher, 18 | ), 19 | ); 20 | 21 | Matcher matchesDioException( 22 | DioExceptionType type, { 23 | String? messageContains, 24 | String? stackTraceContains, 25 | Object? matcher, 26 | }) { 27 | TypeMatcher base = isA().having( 28 | (e) => e.type, 29 | 'type', 30 | equals(type), 31 | ); 32 | if (messageContains != null) { 33 | base = base.having( 34 | (e) => e.message, 35 | 'message', 36 | contains(messageContains), 37 | ); 38 | } 39 | if (stackTraceContains != null) { 40 | base = base.having( 41 | (e) => e.stackTrace.toString(), 42 | 'stackTrace', 43 | contains(stackTraceContains), 44 | ); 45 | } 46 | return allOf([ 47 | base, 48 | if (matcher != null) matcher, 49 | ]); 50 | } 51 | -------------------------------------------------------------------------------- /dio_test/lib/src/test/parameter_tests.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | import 'package:test/test.dart'; 3 | 4 | import '../../util.dart'; 5 | 6 | void parameterTests( 7 | Dio Function(String baseUrl) create, 8 | ) { 9 | late Dio dio; 10 | 11 | setUp(() { 12 | dio = create(httpbunBaseUrl); 13 | }); 14 | 15 | group('parameters', () { 16 | group('generic parameters', () { 17 | test('default (Map)', () async { 18 | final response = await dio.get('/get'); 19 | expect(response.data, isA()); 20 | expect(response.data, isNotEmpty); 21 | }); 22 | 23 | test('Map', () async { 24 | final response = await dio.get('/get'); 25 | expect(response.data, isA()); 26 | expect(response.data, isNotEmpty); 27 | }); 28 | 29 | test('String', () async { 30 | final response = await dio.get('/get'); 31 | expect(response.data, isA()); 32 | expect(response.data, isNotEmpty); 33 | }); 34 | 35 | test('List', () async { 36 | final response = await dio.post( 37 | '/payload', 38 | data: '[1,2,3]', 39 | ); 40 | expect(response.data, isA()); 41 | expect(response.data, isNotEmpty); 42 | expect(response.data![0], 1); 43 | }); 44 | }); 45 | }); 46 | } 47 | -------------------------------------------------------------------------------- /dio_test/lib/src/test/suite.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | import '../../tests.dart'; 3 | 4 | typedef TestSuiteFunction = void Function( 5 | Dio Function(String baseUrl) create, 6 | ); 7 | 8 | const _tests = [ 9 | basicTests, 10 | cancellationTests, 11 | corsTests, 12 | downloadTests, 13 | headerTests, 14 | httpMethodTests, 15 | parameterTests, 16 | redirectTests, 17 | statusCodeTests, 18 | timeoutTests, 19 | uploadTests, 20 | urlEncodedTests, 21 | ]; 22 | 23 | void dioAdapterTestSuite( 24 | Dio Function(String baseUrl) create, { 25 | List tests = _tests, 26 | }) { 27 | for (final test in tests) { 28 | test(create); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /dio_test/lib/src/utils.dart: -------------------------------------------------------------------------------- 1 | const kIsWeb = bool.hasEnvironment('dart.library.js_util') 2 | ? bool.fromEnvironment('dart.library.js_util') 3 | : identical(0, 0.0); 4 | 5 | const nonRoutableUrl = 'http://10.0.0.0'; 6 | 7 | /// https://github.com/dart-lang/sdk/blob/59add4f01ef4741e10f64db9c2c8655cfe738ccb/tests/corelib/finalizer_test.dart#L86-L101 8 | void produceGarbage() { 9 | const approximateWordSize = 4; 10 | 11 | List sink = []; 12 | for (int i = 0; i < 500; ++i) { 13 | final filler = i % 2 == 0 ? 1 : sink; 14 | if (i % 250 == 1) { 15 | // 2 x 25 MB in old space. 16 | sink = List.filled(25 * 1024 * 1024 ~/ approximateWordSize, filler); 17 | } else { 18 | // 498 x 50 KB in new space 19 | sink = List.filled(50 * 1024 ~/ approximateWordSize, filler); 20 | } 21 | } 22 | print(sink.hashCode); // Ensure there's real use of the allocation. 23 | } 24 | -------------------------------------------------------------------------------- /dio_test/lib/tests.dart: -------------------------------------------------------------------------------- 1 | export 'src/test/basic_tests.dart'; 2 | export 'src/test/cancellation_tests.dart'; 3 | export 'src/test/cors_tests.dart'; 4 | export 'src/test/download_tests.dart'; 5 | export 'src/test/headers_tests.dart'; 6 | export 'src/test/http_method_tests.dart'; 7 | export 'src/test/parameter_tests.dart'; 8 | export 'src/test/redirect_tests.dart'; 9 | export 'src/test/status_code_tests.dart'; 10 | export 'src/test/suite.dart'; 11 | export 'src/test/timeout_tests.dart'; 12 | export 'src/test/upload_tests.dart'; 13 | export 'src/test/url_encoded_tests.dart'; 14 | -------------------------------------------------------------------------------- /dio_test/lib/util.dart: -------------------------------------------------------------------------------- 1 | export 'src/httpbun.dart'; 2 | export 'src/matcher.dart'; 3 | export 'src/utils.dart'; 4 | -------------------------------------------------------------------------------- /dio_test/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: dio_test 2 | version: 1.0.0 3 | publish_to: none 4 | homepage: https://github.com/cfug/dio 5 | repository: https://github.com/cfug/dio/blob/main/dio_test 6 | issue_tracker: https://github.com/cfug/dio/issues 7 | 8 | environment: 9 | sdk: '>=2.18.0 <4.0.0' 10 | 11 | dependencies: 12 | dio: any 13 | path: any 14 | 15 | dev_dependencies: 16 | lints: any 17 | test: any 18 | -------------------------------------------------------------------------------- /example_dart/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.ipr 14 | *.iws 15 | .idea/ 16 | 17 | # The .vscode folder contains launch configuration and tasks you configure in 18 | # VS Code which you may wish to be included in version control, so this line 19 | # is commented out by default. 20 | #.vscode/ 21 | 22 | # Flutter/Dart/Pub related 23 | **/doc/api/ 24 | .dart_tool/ 25 | .flutter-plugins 26 | .packages 27 | .pub-cache/ 28 | .pub/ 29 | build/ 30 | -------------------------------------------------------------------------------- /example_dart/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: ../analysis_options.yaml 2 | -------------------------------------------------------------------------------- /example_dart/dart_test.yaml: -------------------------------------------------------------------------------- 1 | file_reporters: 2 | json: build/reports/test-results.json 3 | -------------------------------------------------------------------------------- /example_dart/dio_example.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /example_dart/lib/adapter.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:typed_data'; 3 | 4 | import 'package:dio/dio.dart'; 5 | 6 | class MyAdapter implements HttpClientAdapter { 7 | final HttpClientAdapter _adapter = HttpClientAdapter(); 8 | 9 | @override 10 | Future fetch( 11 | RequestOptions options, 12 | Stream? requestStream, 13 | Future? cancelFuture, 14 | ) async { 15 | final uri = options.uri; 16 | // Hook requests to pub.dev 17 | if (uri.host == 'pub.dev') { 18 | return ResponseBody.fromString('Welcome to pub.dev', 200); 19 | } 20 | return _adapter.fetch(options, requestStream, cancelFuture); 21 | } 22 | 23 | @override 24 | void close({bool force = false}) { 25 | _adapter.close(force: force); 26 | } 27 | } 28 | 29 | void main() async { 30 | final dio = Dio()..httpClientAdapter = MyAdapter(); 31 | Response response = await dio.get('https://pub.dev/'); 32 | print(response); 33 | response = await dio.get('https://dart.dev/'); 34 | print(response); 35 | } 36 | -------------------------------------------------------------------------------- /example_dart/lib/bee.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/example_dart/lib/bee.mp4 -------------------------------------------------------------------------------- /example_dart/lib/cancel_request.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:dio/dio.dart'; 4 | 5 | void main() async { 6 | final dio = Dio(); 7 | dio.interceptors.add(LogInterceptor()); 8 | // Token can be shared with different requests. 9 | final token = CancelToken(); 10 | // In one minute, we cancel! 11 | Timer(const Duration(milliseconds: 500), () { 12 | token.cancel('cancelled'); 13 | }); 14 | 15 | // The follow three requests with the same token. 16 | final url1 = 'https://pub.dev'; 17 | final url2 = 'https://dart.dev'; 18 | final url3 = 'https://flutter.dev'; 19 | 20 | await Future.wait([ 21 | dio 22 | .get(url1, cancelToken: token) 23 | .then((response) => print('${response.requestOptions.path}: succeed!')) 24 | .catchError( 25 | (e) { 26 | if (CancelToken.isCancel(e)) { 27 | print('$url1: $e'); 28 | } 29 | }, 30 | ), 31 | dio 32 | .get(url2, cancelToken: token) 33 | .then((response) => print('${response.requestOptions.path}: succeed!')) 34 | .catchError((e) { 35 | if (CancelToken.isCancel(e)) { 36 | print('$url2: $e'); 37 | } 38 | }), 39 | dio 40 | .get(url3, cancelToken: token) 41 | .then((response) => print('${response.requestOptions.path}: succeed!')) 42 | .catchError((e) { 43 | if (CancelToken.isCancel(e)) { 44 | print('$url3: $e'); 45 | } 46 | print(e); 47 | }), 48 | ]); 49 | } 50 | -------------------------------------------------------------------------------- /example_dart/lib/cookie_mgr.dart: -------------------------------------------------------------------------------- 1 | import 'package:cookie_jar/cookie_jar.dart'; 2 | import 'package:dio/dio.dart'; 3 | import 'package:dio_cookie_manager/dio_cookie_manager.dart'; 4 | 5 | void main() async { 6 | final dio = Dio(); 7 | final cookieJar = CookieJar(); 8 | dio.interceptors 9 | ..add(LogInterceptor()) 10 | ..add(CookieManager(cookieJar)); 11 | await dio.get('https://baidu.com/'); 12 | // Print cookies 13 | print(cookieJar.loadForRequest(Uri.parse('https://baidu.com/'))); 14 | // second request with the cookie 15 | await dio.get('https://baidu.com/'); 16 | } 17 | -------------------------------------------------------------------------------- /example_dart/lib/custom_cache_interceptor.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | 3 | class CacheInterceptor extends Interceptor { 4 | CacheInterceptor(); 5 | 6 | final _cache = {}; 7 | 8 | @override 9 | void onRequest(RequestOptions options, RequestInterceptorHandler handler) { 10 | final response = _cache[options.uri]; 11 | if (options.extra['refresh'] == true) { 12 | print('${options.uri}: force refresh, ignore cache! \n'); 13 | return handler.next(options); 14 | } else if (response != null) { 15 | print('cache hit: ${options.uri} \n'); 16 | return handler.resolve(response); 17 | } 18 | super.onRequest(options, handler); 19 | } 20 | 21 | @override 22 | void onResponse(Response response, ResponseInterceptorHandler handler) { 23 | _cache[response.requestOptions.uri] = response; 24 | super.onResponse(response, handler); 25 | } 26 | 27 | @override 28 | void onError(DioException err, ErrorInterceptorHandler handler) { 29 | print('onError: $err'); 30 | super.onError(err, handler); 31 | } 32 | } 33 | 34 | void main() async { 35 | final dio = Dio(); 36 | dio.options.baseUrl = 'https://pub.dev'; 37 | dio.interceptors 38 | ..add(CacheInterceptor()) 39 | ..add(LogInterceptor(requestHeader: false, responseHeader: false)); 40 | 41 | await dio.get('/'); // second request 42 | await dio.get('/'); // Will hit cache 43 | // Force refresh 44 | await dio.get('/', options: Options(extra: {'refresh': true})); 45 | } 46 | -------------------------------------------------------------------------------- /example_dart/lib/extend_dio.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | import 'package:dio/io.dart'; 3 | 4 | class HttpService extends DioForNative { 5 | HttpService([super.baseOptions]) { 6 | options 7 | ..baseUrl = 'https://httpbin.org/' 8 | ..contentType = Headers.jsonContentType; 9 | } 10 | 11 | Future echo(String data) { 12 | return post('/post', data: data).then((resp) => resp.data['data']); 13 | } 14 | } 15 | 16 | void main() async { 17 | final httpService = HttpService(); 18 | final res = await httpService.echo('hello server!'); 19 | print(res); 20 | } 21 | -------------------------------------------------------------------------------- /example_dart/lib/generic.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | 3 | void main() async { 4 | final dio = Dio( 5 | BaseOptions( 6 | baseUrl: 'https://httpbin.org/', 7 | method: 'GET', 8 | ), 9 | ); 10 | 11 | Response response; 12 | // No generic type, the ResponseType will work. 13 | response = await dio.get('/get'); 14 | print(response.data is Map); 15 | // Specify the generic type(Map) 16 | response = await dio.get('/get'); 17 | print(response.data is Map); 18 | 19 | // Specify the generic type(String) 20 | response = await dio.get('/get'); 21 | print(response.data is String); 22 | // Specify the ResponseType as ResponseType.plain 23 | response = await dio.get( 24 | '/get', 25 | options: Options(responseType: ResponseType.plain), 26 | ); 27 | print(response.data is String); 28 | 29 | // the content of "https://baidu.com" is a html file, So it can't be convert to Map type, 30 | // it will cause a Error (type 'String' is not a subtype of type 'Map') 31 | try { 32 | response = await dio.get('https://baidu.com'); 33 | } on DioException catch (e) { 34 | print(e.message); 35 | } 36 | 37 | // This works well. 38 | response = await dio.get('https://baidu.com'); 39 | 40 | // This works well too. 41 | response = await dio.get('https://baidu.com'); 42 | 43 | // This is the recommended way. 44 | final r = await dio.get('https://baidu.com'); 45 | print(r.data?.length); 46 | } 47 | -------------------------------------------------------------------------------- /example_dart/lib/http2_adapter.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | import 'package:dio_http2_adapter/dio_http2_adapter.dart'; 3 | 4 | void main() async { 5 | final dio = Dio() 6 | ..options.baseUrl = 'https://pub.dev' 7 | ..interceptors.add(LogInterceptor()) 8 | ..httpClientAdapter = Http2Adapter( 9 | ConnectionManager(idleTimeout: const Duration(seconds: 10)), 10 | ); 11 | 12 | Response response; 13 | response = await dio.get('/?xx=6'); 14 | for (final e in response.redirects) { 15 | print('redirect: ${e.statusCode} ${e.location}'); 16 | } 17 | print(response.data); 18 | } 19 | -------------------------------------------------------------------------------- /example_dart/lib/options.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:dio/dio.dart'; 4 | 5 | void main() async { 6 | final dio = Dio( 7 | BaseOptions( 8 | baseUrl: 'https://httpbin.org/', 9 | connectTimeout: const Duration(seconds: 5), 10 | receiveTimeout: const Duration(seconds: 10), 11 | // 5s 12 | headers: { 13 | HttpHeaders.userAgentHeader: 'dio', 14 | 'api': '1.0.0', 15 | }, 16 | contentType: Headers.jsonContentType, 17 | // Transform the response data to a String encoded with UTF8. 18 | // The default value is [ResponseType.JSON]. 19 | responseType: ResponseType.plain, 20 | ), 21 | ); 22 | 23 | Response response; 24 | 25 | response = await dio.get('/get'); 26 | print(response.data); 27 | 28 | final responseMap = await dio.get( 29 | '/get', 30 | // Transform response data to Json Map 31 | options: Options(responseType: ResponseType.json), 32 | ); 33 | print(responseMap.data); 34 | response = await dio.post( 35 | '/post', 36 | data: { 37 | 'id': 8, 38 | 'info': {'name': 'wendux', 'age': 25}, 39 | }, 40 | // Send data with "application/x-www-form-urlencoded" format 41 | options: Options( 42 | contentType: Headers.formUrlEncodedContentType, 43 | ), 44 | ); 45 | print(response.data); 46 | 47 | response = await dio.fetch( 48 | RequestOptions(path: 'https://baidu.com/'), 49 | ); 50 | print(response.data); 51 | } 52 | -------------------------------------------------------------------------------- /example_dart/lib/post_stream_and_bytes.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:convert'; 3 | import 'dart:io'; 4 | 5 | import 'package:dio/dio.dart'; 6 | 7 | void main() async { 8 | final dio = Dio( 9 | BaseOptions( 10 | connectTimeout: const Duration(seconds: 5), 11 | baseUrl: 'https://httpbin.org/', 12 | ), 13 | ); 14 | 15 | dio.interceptors.add(LogInterceptor(responseBody: true)); 16 | 17 | // final file = File('./example/bee.mp4'); 18 | // 19 | // // Sending stream 20 | // await dio.post('post', 21 | // data: file.openRead(), 22 | // options: Options( 23 | // headers: { 24 | // HttpHeaders.contentTypeHeader: ContentType.text.toString(), 25 | // HttpHeaders.contentLengthHeader: file.lengthSync(), 26 | // // HttpHeaders.authorizationHeader: 'Bearer $token', 27 | // }, 28 | // ), 29 | // ); 30 | 31 | // Sending bytes with Stream(Just an example, you can send json(Map) directly in action) 32 | final postData = utf8.encode('{"userName":"wendux"}'); 33 | await dio.post( 34 | 'post', 35 | data: Stream.fromIterable([postData]), 36 | onSendProgress: (a, b) => print(a), 37 | options: Options( 38 | headers: { 39 | HttpHeaders.contentLengthHeader: postData.length, // Set content-length 40 | }, 41 | ), 42 | ); 43 | } 44 | -------------------------------------------------------------------------------- /example_dart/lib/proxy.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:dio/dio.dart'; 4 | import 'package:dio/io.dart'; 5 | 6 | void main() async { 7 | final dio = Dio(); 8 | dio.options 9 | ..headers['user-agent'] = 'xxx' 10 | ..contentType = 'text'; 11 | dio.httpClientAdapter = IOHttpClientAdapter( 12 | createHttpClient: () { 13 | final client = HttpClient(); 14 | client.findProxy = (uri) { 15 | // Proxy all request to localhost:8888. 16 | // Be aware, the proxy should went through you running device, 17 | // not the host platform. 18 | return 'PROXY localhost:8888'; 19 | }; 20 | client.badCertificateCallback = 21 | (X509Certificate cert, String host, int port) => true; 22 | return client; 23 | }, 24 | ); 25 | 26 | Response response; 27 | response = await dio.get('https://www.baidu.com'); 28 | print(response.statusCode); 29 | response = await dio.get('https://www.baidu.com'); 30 | print(response.statusCode); 31 | } 32 | -------------------------------------------------------------------------------- /example_dart/lib/queue_interceptors.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | 3 | void main() async { 4 | final dio = Dio(); 5 | dio.options.baseUrl = 'https://httpbin.org/status/'; 6 | dio.interceptors.add( 7 | InterceptorsWrapper( 8 | onRequest: ( 9 | RequestOptions requestOptions, 10 | RequestInterceptorHandler handler, 11 | ) { 12 | print(requestOptions.uri); 13 | Future.delayed(const Duration(seconds: 2), () { 14 | handler.next(requestOptions); 15 | }); 16 | }, 17 | ), 18 | ); 19 | print( 20 | 'All of the requests enter the interceptor at once, rather than executing sequentially.', 21 | ); 22 | await makeRequests(dio); 23 | print( 24 | 'All of the requests enter the interceptor sequentially by QueuedInterceptors', 25 | ); 26 | dio.interceptors 27 | ..clear() 28 | ..add( 29 | QueuedInterceptorsWrapper( 30 | onRequest: ( 31 | RequestOptions requestOptions, 32 | RequestInterceptorHandler handler, 33 | ) { 34 | print(requestOptions.uri); 35 | Future.delayed(const Duration(seconds: 2), () { 36 | handler.next(requestOptions); 37 | }); 38 | }, 39 | ), 40 | ); 41 | await makeRequests(dio); 42 | } 43 | 44 | Future makeRequests(Dio dio) async { 45 | try { 46 | await Future.wait([ 47 | dio.get('/200'), 48 | dio.get('/201'), 49 | dio.get('/201'), 50 | ]); 51 | } catch (e) { 52 | print(e); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /example_dart/lib/test.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | 3 | // void getHttp() async { 4 | // final dio = Dio(); 5 | // dio.interceptors.add(LogInterceptor(responseBody: true)); 6 | // dio.options.baseUrl = 'https://httpbin.org'; 7 | // dio.options.headers = {'Authorization': 'Bearer '}; 8 | // //dio.options.baseUrl = "http://localhost:3000"; 9 | // final response = await dio.post( 10 | // '/post', 11 | // data: null, 12 | // options: Options( 13 | // contentType: Headers.jsonContentType, 14 | // ), 15 | // ); 16 | // print(response); 17 | // } 18 | // 19 | // void main() async { 20 | // getHttp(); 21 | // } 22 | 23 | void main() async { 24 | final dio = Dio()..interceptors.add(ProblemInterceptor()); 25 | await dio.get('https://baidu.com/'); 26 | } 27 | 28 | class ProblemInterceptor extends Interceptor { 29 | @override 30 | void onResponse(Response response, ResponseInterceptorHandler handler) { 31 | throw Exception('Unexpected problem inside onResponse'); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /example_dart/lib/upload.txt: -------------------------------------------------------------------------------- 1 | 你好, 世界 2 | & 3 | $ 4 | % U。想 。。 5 | 6 | -------------------------------------------------------------------------------- /example_dart/lib/xx.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/example_dart/lib/xx.png -------------------------------------------------------------------------------- /example_dart/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: dio_example 2 | description: The example snippets for Dio. 3 | version: 0.0.1 4 | publish_to: "none" 5 | 6 | environment: 7 | sdk: ">=3.0.0 <4.0.0" 8 | 9 | dependencies: 10 | cookie_jar: 11 | crypto: 12 | dio: 13 | dio_cookie_manager: 14 | dio_http2_adapter: 15 | 16 | dependency_overrides: 17 | dio: 18 | path: ../dio 19 | dio_cookie_manager: 20 | path: ../plugins/cookie_manager 21 | dio_http2_adapter: 22 | path: ../plugins/http2_adapter 23 | 24 | dev_dependencies: 25 | lints: any 26 | -------------------------------------------------------------------------------- /example_flutter_app/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.ipr 14 | *.iws 15 | .idea/ 16 | 17 | # The .vscode folder contains launch configuration and tasks you configure in 18 | # VS Code which you may wish to be included in version control, so this line 19 | # is commented out by default. 20 | #.vscode/ 21 | 22 | # Flutter/Dart/Pub related 23 | **/doc/api/ 24 | **/ios/Flutter/.last_build_id 25 | .dart_tool/ 26 | .flutter-plugins 27 | .flutter-plugins-dependencies 28 | .packages 29 | .pub-cache/ 30 | .pub/ 31 | /build/ 32 | 33 | # Web related 34 | lib/generated_plugin_registrant.dart 35 | 36 | # Symbolication related 37 | app.*.symbols 38 | 39 | # Obfuscation related 40 | app.*.map.json 41 | 42 | # Android Studio will place build artifacts here 43 | /android/app/debug 44 | /android/app/profile 45 | /android/app/release 46 | -------------------------------------------------------------------------------- /example_flutter_app/README.md: -------------------------------------------------------------------------------- 1 | # flutter_app 2 | 3 | A new Flutter application for dio test. 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter application. 8 | 9 | A few resources to get you started if this is your first Flutter project: 10 | 11 | - [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) 13 | 14 | For help getting started with Flutter, view our 15 | [online documentation](https://flutter.dev/docs), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /example_flutter_app/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: ../analysis_options.yaml 2 | -------------------------------------------------------------------------------- /example_flutter_app/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/to/reference-keystore 11 | key.properties 12 | **/*.keystore 13 | **/*.jks 14 | -------------------------------------------------------------------------------- /example_flutter_app/android/app/src/main/kotlin/cn/flutter/dio_flutter_example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package cn.flutter.dio_flutter_example 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() 6 | -------------------------------------------------------------------------------- /example_flutter_app/android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example_flutter_app/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example_flutter_app/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/example_flutter_app/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example_flutter_app/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/example_flutter_app/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example_flutter_app/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/example_flutter_app/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example_flutter_app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/example_flutter_app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example_flutter_app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/example_flutter_app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example_flutter_app/android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /example_flutter_app/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /example_flutter_app/android/build.gradle: -------------------------------------------------------------------------------- 1 | allprojects { 2 | repositories { 3 | google() 4 | mavenCentral() 5 | } 6 | } 7 | 8 | rootProject.buildDir = "../build" 9 | subprojects { 10 | project.buildDir = "${rootProject.buildDir}/${project.name}" 11 | } 12 | subprojects { 13 | project.evaluationDependsOn(":app") 14 | } 15 | 16 | tasks.register("clean", Delete) { 17 | delete rootProject.buildDir 18 | } 19 | -------------------------------------------------------------------------------- /example_flutter_app/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /example_flutter_app/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip 6 | -------------------------------------------------------------------------------- /example_flutter_app/android/settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | def flutterSdkPath = { 3 | def properties = new Properties() 4 | file("local.properties").withInputStream { properties.load(it) } 5 | def flutterSdkPath = properties.getProperty("flutter.sdk") 6 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 7 | return flutterSdkPath 8 | }() 9 | 10 | includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") 11 | 12 | repositories { 13 | google() 14 | mavenCentral() 15 | gradlePluginPortal() 16 | } 17 | } 18 | 19 | plugins { 20 | id "dev.flutter.flutter-plugin-loader" version "1.0.0" 21 | id "com.android.application" version "8.1.0" apply false 22 | id "org.jetbrains.kotlin.android" version "1.8.22" apply false 23 | } 24 | 25 | include ":app" 26 | -------------------------------------------------------------------------------- /example_flutter_app/dio_flutter_example.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /example_flutter_app/example_flutter_app.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /example_flutter_app/ios/.gitignore: -------------------------------------------------------------------------------- 1 | **/dgph 2 | *.mode1v3 3 | *.mode2v3 4 | *.moved-aside 5 | *.pbxuser 6 | *.perspectivev3 7 | **/*sync/ 8 | .sconsign.dblite 9 | .tags* 10 | **/.vagrant/ 11 | **/DerivedData/ 12 | Icon? 13 | **/Pods/ 14 | **/.symlinks/ 15 | profile 16 | xcuserdata 17 | **/.generated/ 18 | Flutter/App.framework 19 | Flutter/Flutter.framework 20 | Flutter/Flutter.podspec 21 | Flutter/Generated.xcconfig 22 | Flutter/ephemeral/ 23 | Flutter/app.flx 24 | Flutter/app.zip 25 | Flutter/flutter_assets/ 26 | Flutter/flutter_export_environment.sh 27 | ServiceDefinitions.json 28 | Runner/GeneratedPluginRegistrant.* 29 | 30 | # Exceptions to above rules. 31 | !default.mode1v3 32 | !default.mode2v3 33 | !default.pbxuser 34 | !default.perspectivev3 35 | -------------------------------------------------------------------------------- /example_flutter_app/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 12.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /example_flutter_app/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /example_flutter_app/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /example_flutter_app/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example_flutter_app/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example_flutter_app/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example_flutter_app/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example_flutter_app/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example_flutter_app/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example_flutter_app/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Flutter 2 | import UIKit 3 | 4 | @main 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 | -------------------------------------------------------------------------------- /example_flutter_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/example_flutter_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /example_flutter_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/example_flutter_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /example_flutter_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/example_flutter_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /example_flutter_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/example_flutter_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /example_flutter_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/example_flutter_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /example_flutter_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/example_flutter_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /example_flutter_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/example_flutter_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /example_flutter_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/example_flutter_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /example_flutter_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/example_flutter_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /example_flutter_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/example_flutter_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /example_flutter_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/example_flutter_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /example_flutter_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/example_flutter_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /example_flutter_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/example_flutter_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /example_flutter_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/example_flutter_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /example_flutter_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/example_flutter_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /example_flutter_app/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /example_flutter_app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/example_flutter_app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example_flutter_app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/example_flutter_app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /example_flutter_app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/example_flutter_app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /example_flutter_app/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /example_flutter_app/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /example_flutter_app/ios/RunnerTests/RunnerTests.swift: -------------------------------------------------------------------------------- 1 | import Flutter 2 | import UIKit 3 | import XCTest 4 | 5 | class RunnerTests: XCTestCase { 6 | 7 | func testExample() { 8 | // If you add code to the Runner application, consider adding tests here. 9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest. 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /example_flutter_app/lib/http.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | 3 | final dio = Dio( 4 | BaseOptions( 5 | connectTimeout: const Duration(seconds: 3), 6 | ), 7 | ); 8 | -------------------------------------------------------------------------------- /example_flutter_app/linux/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral 2 | -------------------------------------------------------------------------------- /example_flutter_app/linux/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | 10 | void fl_register_plugins(FlPluginRegistry* registry) { 11 | } 12 | -------------------------------------------------------------------------------- /example_flutter_app/linux/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void fl_register_plugins(FlPluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /example_flutter_app/linux/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | ) 7 | 8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 9 | ) 10 | 11 | set(PLUGIN_BUNDLED_LIBRARIES) 12 | 13 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 14 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) 15 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 16 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 18 | endforeach(plugin) 19 | 20 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 21 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) 22 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 23 | endforeach(ffi_plugin) 24 | -------------------------------------------------------------------------------- /example_flutter_app/linux/runner/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.13) 2 | project(runner LANGUAGES CXX) 3 | 4 | # Define the application target. To change its name, change BINARY_NAME in the 5 | # top-level CMakeLists.txt, not the value here, or `flutter run` will no longer 6 | # work. 7 | # 8 | # Any new source files that you add to the application should be added here. 9 | add_executable(${BINARY_NAME} 10 | "main.cc" 11 | "my_application.cc" 12 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 13 | ) 14 | 15 | # Apply the standard set of build settings. This can be removed for applications 16 | # that need different build settings. 17 | apply_standard_settings(${BINARY_NAME}) 18 | 19 | # Add preprocessor definitions for the application ID. 20 | add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") 21 | 22 | # Add dependency libraries. Add any application-specific dependencies here. 23 | target_link_libraries(${BINARY_NAME} PRIVATE flutter) 24 | target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) 25 | 26 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") 27 | -------------------------------------------------------------------------------- /example_flutter_app/linux/runner/main.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | int main(int argc, char** argv) { 4 | g_autoptr(MyApplication) app = my_application_new(); 5 | return g_application_run(G_APPLICATION(app), argc, argv); 6 | } 7 | -------------------------------------------------------------------------------- /example_flutter_app/linux/runner/my_application.h: -------------------------------------------------------------------------------- 1 | #ifndef FLUTTER_MY_APPLICATION_H_ 2 | #define FLUTTER_MY_APPLICATION_H_ 3 | 4 | #include 5 | 6 | G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, 7 | GtkApplication) 8 | 9 | /** 10 | * my_application_new: 11 | * 12 | * Creates a new Flutter-based application. 13 | * 14 | * Returns: a new #MyApplication. 15 | */ 16 | MyApplication* my_application_new(); 17 | 18 | #endif // FLUTTER_MY_APPLICATION_H_ 19 | -------------------------------------------------------------------------------- /example_flutter_app/macos/.gitignore: -------------------------------------------------------------------------------- 1 | # Flutter-related 2 | **/Flutter/ephemeral/ 3 | **/Pods/ 4 | 5 | # Xcode-related 6 | **/dgph 7 | **/xcuserdata/ 8 | -------------------------------------------------------------------------------- /example_flutter_app/macos/Flutter/Flutter-Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "ephemeral/Flutter-Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /example_flutter_app/macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "ephemeral/Flutter-Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /example_flutter_app/macos/Flutter/GeneratedPluginRegistrant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | import FlutterMacOS 6 | import Foundation 7 | 8 | 9 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 10 | } 11 | -------------------------------------------------------------------------------- /example_flutter_app/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example_flutter_app/macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example_flutter_app/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example_flutter_app/macos/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | @main 5 | class AppDelegate: FlutterAppDelegate { 6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { 7 | return true 8 | } 9 | 10 | override func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool { 11 | return true 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /example_flutter_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/example_flutter_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /example_flutter_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/example_flutter_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /example_flutter_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/example_flutter_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /example_flutter_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/example_flutter_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /example_flutter_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/example_flutter_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /example_flutter_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/example_flutter_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /example_flutter_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/example_flutter_app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png -------------------------------------------------------------------------------- /example_flutter_app/macos/Runner/Configs/AppInfo.xcconfig: -------------------------------------------------------------------------------- 1 | // Application-level settings for the Runner target. 2 | // 3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the 4 | // future. If not, the values below would default to using the project name when this becomes a 5 | // 'flutter create' template. 6 | 7 | // The application's name. By default this is also the title of the Flutter window. 8 | PRODUCT_NAME = dio_flutter_example 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = cn.flutter.dioFlutterExample 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2024 cn.flutter. All rights reserved. 15 | -------------------------------------------------------------------------------- /example_flutter_app/macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /example_flutter_app/macos/Runner/Configs/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Release.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /example_flutter_app/macos/Runner/Configs/Warnings.xcconfig: -------------------------------------------------------------------------------- 1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings 2 | GCC_WARN_UNDECLARED_SELECTOR = YES 3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES 4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE 5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES 6 | CLANG_WARN_PRAGMA_PACK = YES 7 | CLANG_WARN_STRICT_PROTOTYPES = YES 8 | CLANG_WARN_COMMA = YES 9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES 10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES 11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES 12 | GCC_WARN_SHADOW = YES 13 | CLANG_WARN_UNREACHABLE_CODE = YES 14 | -------------------------------------------------------------------------------- /example_flutter_app/macos/Runner/DebugProfile.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.cs.allow-jit 8 | 9 | com.apple.security.network.server 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /example_flutter_app/macos/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | $(PRODUCT_COPYRIGHT) 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /example_flutter_app/macos/Runner/MainFlutterWindow.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | class MainFlutterWindow: NSWindow { 5 | override func awakeFromNib() { 6 | let flutterViewController = FlutterViewController() 7 | let windowFrame = self.frame 8 | self.contentViewController = flutterViewController 9 | self.setFrame(windowFrame, display: true) 10 | 11 | RegisterGeneratedPlugins(registry: flutterViewController) 12 | 13 | super.awakeFromNib() 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /example_flutter_app/macos/Runner/Release.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.network.client 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /example_flutter_app/macos/RunnerTests/RunnerTests.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | import XCTest 4 | 5 | class RunnerTests: XCTestCase { 6 | 7 | func testExample() { 8 | // If you add code to the Runner application, consider adding tests here. 9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest. 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /example_flutter_app/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: dio_flutter_example 2 | description: Demonstrates how to use the dio package. 3 | publish_to: 'none' 4 | 5 | environment: 6 | sdk: ">=2.18.0 <4.0.0" 7 | 8 | dependencies: 9 | flutter: 10 | sdk: flutter 11 | dio: 12 | path: ../dio 13 | 14 | dev_dependencies: 15 | lints: any 16 | 17 | flutter: 18 | uses-material-design: true 19 | -------------------------------------------------------------------------------- /example_flutter_app/web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/example_flutter_app/web/favicon.png -------------------------------------------------------------------------------- /example_flutter_app/web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/example_flutter_app/web/icons/Icon-192.png -------------------------------------------------------------------------------- /example_flutter_app/web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/example_flutter_app/web/icons/Icon-512.png -------------------------------------------------------------------------------- /example_flutter_app/web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/example_flutter_app/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /example_flutter_app/web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/example_flutter_app/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /example_flutter_app/web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | dio_flutter_example 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /example_flutter_app/web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dio_flutter_example", 3 | "short_name": "dio_flutter_example", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "background_color": "#0175C2", 7 | "theme_color": "#0175C2", 8 | "description": "A new Flutter project.", 9 | "orientation": "portrait-primary", 10 | "prefer_related_applications": false, 11 | "icons": [ 12 | { 13 | "src": "icons/Icon-192.png", 14 | "sizes": "192x192", 15 | "type": "image/png" 16 | }, 17 | { 18 | "src": "icons/Icon-512.png", 19 | "sizes": "512x512", 20 | "type": "image/png" 21 | }, 22 | { 23 | "src": "icons/Icon-maskable-192.png", 24 | "sizes": "192x192", 25 | "type": "image/png", 26 | "purpose": "maskable" 27 | }, 28 | { 29 | "src": "icons/Icon-maskable-512.png", 30 | "sizes": "512x512", 31 | "type": "image/png", 32 | "purpose": "maskable" 33 | } 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /example_flutter_app/windows/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral/ 2 | 3 | # Visual Studio user-specific files. 4 | *.suo 5 | *.user 6 | *.userosscache 7 | *.sln.docstates 8 | 9 | # Visual Studio build-related files. 10 | x64/ 11 | x86/ 12 | 13 | # Visual Studio cache files 14 | # files ending in .cache can be ignored 15 | *.[Cc]ache 16 | # but keep track of directories ending in .cache 17 | !*.[Cc]ache/ 18 | -------------------------------------------------------------------------------- /example_flutter_app/windows/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | 10 | void RegisterPlugins(flutter::PluginRegistry* registry) { 11 | } 12 | -------------------------------------------------------------------------------- /example_flutter_app/windows/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void RegisterPlugins(flutter::PluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /example_flutter_app/windows/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | ) 7 | 8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 9 | ) 10 | 11 | set(PLUGIN_BUNDLED_LIBRARIES) 12 | 13 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 14 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 15 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 16 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 18 | endforeach(plugin) 19 | 20 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 21 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) 22 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 23 | endforeach(ffi_plugin) 24 | -------------------------------------------------------------------------------- /example_flutter_app/windows/runner/flutter_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_FLUTTER_WINDOW_H_ 2 | #define RUNNER_FLUTTER_WINDOW_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include "win32_window.h" 10 | 11 | // A window that does nothing but host a Flutter view. 12 | class FlutterWindow : public Win32Window { 13 | public: 14 | // Creates a new FlutterWindow hosting a Flutter view running |project|. 15 | explicit FlutterWindow(const flutter::DartProject& project); 16 | virtual ~FlutterWindow(); 17 | 18 | protected: 19 | // Win32Window: 20 | bool OnCreate() override; 21 | void OnDestroy() override; 22 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, 23 | LPARAM const lparam) noexcept override; 24 | 25 | private: 26 | // The project to run. 27 | flutter::DartProject project_; 28 | 29 | // The Flutter instance hosted by this window. 30 | std::unique_ptr flutter_controller_; 31 | }; 32 | 33 | #endif // RUNNER_FLUTTER_WINDOW_H_ 34 | -------------------------------------------------------------------------------- /example_flutter_app/windows/runner/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "flutter_window.h" 6 | #include "utils.h" 7 | 8 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, 9 | _In_ wchar_t *command_line, _In_ int show_command) { 10 | // Attach to console when present (e.g., 'flutter run') or create a 11 | // new console when running with a debugger. 12 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { 13 | CreateAndAttachConsole(); 14 | } 15 | 16 | // Initialize COM, so that it is available for use in the library and/or 17 | // plugins. 18 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); 19 | 20 | flutter::DartProject project(L"data"); 21 | 22 | std::vector command_line_arguments = 23 | GetCommandLineArguments(); 24 | 25 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); 26 | 27 | FlutterWindow window(project); 28 | Win32Window::Point origin(10, 10); 29 | Win32Window::Size size(1280, 720); 30 | if (!window.Create(L"dio_flutter_example", origin, size)) { 31 | return EXIT_FAILURE; 32 | } 33 | window.SetQuitOnClose(true); 34 | 35 | ::MSG msg; 36 | while (::GetMessage(&msg, nullptr, 0, 0)) { 37 | ::TranslateMessage(&msg); 38 | ::DispatchMessage(&msg); 39 | } 40 | 41 | ::CoUninitialize(); 42 | return EXIT_SUCCESS; 43 | } 44 | -------------------------------------------------------------------------------- /example_flutter_app/windows/runner/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Runner.rc 4 | // 5 | #define IDI_APP_ICON 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 102 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1001 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /example_flutter_app/windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/example_flutter_app/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /example_flutter_app/windows/runner/runner.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PerMonitorV2 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /example_flutter_app/windows/runner/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_UTILS_H_ 2 | #define RUNNER_UTILS_H_ 3 | 4 | #include 5 | #include 6 | 7 | // Creates a console for the process, and redirects stdout and stderr to 8 | // it for both the runner and the Flutter library. 9 | void CreateAndAttachConsole(); 10 | 11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string 12 | // encoded in UTF-8. Returns an empty std::string on failure. 13 | std::string Utf8FromUtf16(const wchar_t* utf16_string); 14 | 15 | // Gets the command line arguments passed in as a std::vector, 16 | // encoded in UTF-8. Returns an empty std::vector on failure. 17 | std::vector GetCommandLineArguments(); 18 | 19 | #endif // RUNNER_UTILS_H_ 20 | -------------------------------------------------------------------------------- /plugins/compatibility_layer/.gitignore: -------------------------------------------------------------------------------- 1 | # https://dart.dev/guides/libraries/private-files 2 | # Created by `dart pub` 3 | .dart_tool/ 4 | 5 | # Avoid committing pubspec.lock for library packages; see 6 | # https://dart.dev/guides/libraries/private-files#pubspeclock. 7 | pubspec.lock 8 | 9 | coverage 10 | -------------------------------------------------------------------------------- /plugins/compatibility_layer/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # CHANGELOG 2 | 3 | ## Unreleased 4 | 5 | *None.* 6 | 7 | ## 0.1.0 8 | 9 | - Initial version. 10 | -------------------------------------------------------------------------------- /plugins/compatibility_layer/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 The CFUG Team 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. -------------------------------------------------------------------------------- /plugins/compatibility_layer/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: ../../analysis_options.yaml 2 | 3 | analyzer: 4 | language: 5 | strict-raw-types: true 6 | strict-casts: true 7 | strict-inference: true 8 | -------------------------------------------------------------------------------- /plugins/compatibility_layer/dart_test.yaml: -------------------------------------------------------------------------------- 1 | presets: 2 | # empty placeholders required in CI scripts 3 | all: 4 | default: 5 | min: 6 | stable: 7 | beta: 8 | 9 | override_platforms: 10 | chrome: 11 | settings: 12 | headless: true 13 | firefox: 14 | settings: 15 | # headless argument has to be set explicitly for non-chrome browsers 16 | arguments: --headless 17 | executable: 18 | # https://github.com/dart-lang/test/pull/2195 19 | mac_os: '/Applications/Firefox.app/Contents/MacOS/firefox' 20 | -------------------------------------------------------------------------------- /plugins/compatibility_layer/dio_compatibility_layer.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /plugins/compatibility_layer/example/conversion_layer_example.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | import 'package:dio_compatibility_layer/dio_compatibility_layer.dart'; 3 | import 'package:http/http.dart'; 4 | 5 | void main() async { 6 | // Start in the `http` world. You can use `http`, `cronet_http`, 7 | // `cupertino_http` and other `http` compatible packages. 8 | final httpClient = Client(); 9 | 10 | // Make the `httpClient` compatible via the `ConversionLayerAdapter` class. 11 | final dioAdapter = ConversionLayerAdapter(httpClient); 12 | 13 | // Make dio use the `httpClient` via the conversion layer. 14 | final dio = Dio()..httpClientAdapter = dioAdapter; 15 | 16 | // Make a request. 17 | final response = await dio.get('https://dart.dev'); 18 | print(response); 19 | } 20 | -------------------------------------------------------------------------------- /plugins/compatibility_layer/lib/dio_compatibility_layer.dart: -------------------------------------------------------------------------------- 1 | library dio_compatibility_layer; 2 | 3 | export 'src/conversion_layer_adapter.dart'; 4 | -------------------------------------------------------------------------------- /plugins/compatibility_layer/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: dio_compatibility_layer 2 | version: 0.1.0 3 | 4 | description: Enables dio to make use of http packages. 5 | topics: 6 | - dio 7 | - http 8 | - network 9 | - native 10 | - cronet 11 | homepage: https://github.com/cfug/dio 12 | repository: https://github.com/cfug/dio/blob/main/plugins/compatibility_layer 13 | issue_tracker: https://github.com/cfug/dio/issues 14 | 15 | environment: 16 | sdk: ^3.0.0 17 | 18 | dependencies: 19 | dio: ^5.2.0 20 | http: ^1.0.0 21 | 22 | dev_dependencies: 23 | lints: any 24 | test: any 25 | -------------------------------------------------------------------------------- /plugins/compatibility_layer/test/client_mock.dart: -------------------------------------------------------------------------------- 1 | import 'package:http/http.dart'; 2 | 3 | class CloseClientMock implements Client { 4 | bool closeWasCalled = false; 5 | 6 | @override 7 | void close() { 8 | closeWasCalled = true; 9 | } 10 | 11 | @override 12 | dynamic noSuchMethod(Invocation i) => super.noSuchMethod(i); 13 | } 14 | 15 | class ClientMock implements Client { 16 | StreamedResponse? response; 17 | BaseRequest? request; 18 | 19 | @override 20 | Future send(BaseRequest request) async { 21 | this.request = request; 22 | return response!; 23 | } 24 | 25 | @override 26 | dynamic noSuchMethod(Invocation i) => super.noSuchMethod(i); 27 | } 28 | -------------------------------------------------------------------------------- /plugins/cookie_manager/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.ipr 14 | *.iws 15 | .idea/ 16 | 17 | # The .vscode folder contains launch configuration and tasks you configure in 18 | # VS Code which you may wish to be included in version control, so this line 19 | # is commented out by default. 20 | #.vscode/ 21 | 22 | # Flutter/Dart/Pub related 23 | **/doc/api/ 24 | .dart_tool/ 25 | .flutter-plugins 26 | .packages 27 | .pub-cache/ 28 | .pub/ 29 | build/ 30 | 31 | coverage 32 | -------------------------------------------------------------------------------- /plugins/cookie_manager/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 32c946f31bfff6c766229d7b85ef0ae70de2c89a 8 | channel: master 9 | 10 | project_type: package 11 | -------------------------------------------------------------------------------- /plugins/cookie_manager/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # CHANGELOG 2 | 3 | ## Unreleased 4 | 5 | *None.* 6 | 7 | ## 3.2.0 8 | 9 | - Raise the min Dart SDK version to 2.18.0 (implied by the `dio` package). 10 | 11 | ## 3.1.1 12 | 13 | - Fix `FileSystemException` when saving redirect cookies without a proper `host`. 14 | 15 | ## 3.1.0+1 16 | 17 | - Add topics to packages. 18 | 19 | ## 3.1.0 20 | 21 | - Replace `DioError` with `DioException`. 22 | 23 | ## 3.0.0 24 | 25 | ### Breaking changes 26 | 27 | - Bump cookie_jar from 3.0.0 to 4.0.0. 28 | Upgrading to this version will lose all previous cookies. 29 | 30 | ## 2.1.4 31 | 32 | - Fix cookie not applied to the original destination during redirect handling. 33 | - Resolves the location for cookies during redirect handling. 34 | 35 | ## 2.1.3 36 | 37 | - Allow `Set-Cookie` to be parsed in redirect responses. 38 | - Fix new cookies being replaced by old cookies with the same name. 39 | - Sort the cookie by path (longer path first). 40 | 41 | ## 2.1.2 42 | 43 | - Fix empty cookie parsing and header value set. 44 | - Improve code formats according to linter rules. 45 | 46 | ## 2.1.1 47 | 48 | - Fix #1651 49 | - Fix #1674 50 | 51 | ## 2.1.0 52 | 53 | - For the `dio`'s 5.0 release. 54 | 55 | ## 2.0.0 56 | 57 | - support dio 4.0.0 58 | 59 | ## 2.0.0-beta1 60 | 61 | - support nullsafety 62 | 63 | ## 1.0.0 - 2019.9.18 64 | 65 | - First stable version 66 | 67 | ## 0.0.1 - 2019.9.17 68 | 69 | - A cookie manager for Dio. 70 | -------------------------------------------------------------------------------- /plugins/cookie_manager/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Wen Du (wendux) 4 | Copyright (c) 2022 The CFUG Team 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. -------------------------------------------------------------------------------- /plugins/cookie_manager/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: ../../analysis_options.yaml 2 | -------------------------------------------------------------------------------- /plugins/cookie_manager/dart_test.yaml: -------------------------------------------------------------------------------- 1 | file_reporters: 2 | json: build/reports/test-results.json 3 | 4 | presets: 5 | # empty placeholders required in CI scripts 6 | all: 7 | default: 8 | min: 9 | stable: 10 | beta: 11 | -------------------------------------------------------------------------------- /plugins/cookie_manager/dio_cookie_manager.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /plugins/cookie_manager/example/example.dart: -------------------------------------------------------------------------------- 1 | import 'package:cookie_jar/cookie_jar.dart'; 2 | import 'package:dio/dio.dart'; 3 | import 'package:dio_cookie_manager/dio_cookie_manager.dart'; 4 | 5 | void main() async { 6 | final dio = Dio(); 7 | final cookieJar = CookieJar(); 8 | dio.interceptors.add(CookieManager(cookieJar)); 9 | await dio.get('https://baidu.com/'); 10 | // Print cookies 11 | print(cookieJar.loadForRequest(Uri.parse('https://baidu.com/'))); 12 | // second request with the cookie 13 | await dio.get('https://baidu.com/'); 14 | } 15 | -------------------------------------------------------------------------------- /plugins/cookie_manager/lib/dio_cookie_manager.dart: -------------------------------------------------------------------------------- 1 | library dio_cookie_manager; 2 | 3 | export 'src/cookie_mgr.dart'; 4 | -------------------------------------------------------------------------------- /plugins/cookie_manager/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: dio_cookie_manager 2 | version: 3.2.0 3 | 4 | description: A cookie manager combines cookie_jar and dio, based on the interceptor algorithm. 5 | topics: 6 | - dio 7 | - cookie 8 | - network 9 | - storage 10 | - persistence 11 | homepage: https://github.com/cfug/dio 12 | repository: https://github.com/cfug/dio/blob/main/plugins/cookie_manager 13 | issue_tracker: https://github.com/cfug/dio/issues 14 | 15 | environment: 16 | sdk: ">=2.18.0 <4.0.0" 17 | 18 | dependencies: 19 | cookie_jar: ^4.0.0 20 | dio: ^5.2.0 21 | 22 | dev_dependencies: 23 | lints: any 24 | test: ^1.16.4 25 | -------------------------------------------------------------------------------- /plugins/cookie_manager/test/basic_test.dart: -------------------------------------------------------------------------------- 1 | @TestOn('vm') 2 | import 'package:cookie_jar/cookie_jar.dart'; 3 | import 'package:dio/dio.dart'; 4 | import 'package:dio_cookie_manager/dio_cookie_manager.dart'; 5 | import 'package:test/test.dart'; 6 | 7 | void main() { 8 | test('cookie-jar', () async { 9 | final dio = Dio(); 10 | final cookieJar = CookieJar(); 11 | dio.interceptors.add(CookieManager(cookieJar)); 12 | await dio.get('https://pub.dev/'); 13 | // second request with the cookie 14 | await dio.get('https://pub.dev/'); 15 | }); 16 | } 17 | -------------------------------------------------------------------------------- /plugins/http2_adapter/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.ipr 14 | *.iws 15 | .idea/ 16 | 17 | # The .vscode folder contains launch configuration and tasks you configure in 18 | # VS Code which you may wish to be included in version control, so this line 19 | # is commented out by default. 20 | #.vscode/ 21 | 22 | # Flutter/Dart/Pub related 23 | **/doc/api/ 24 | .dart_tool/ 25 | .flutter-plugins 26 | .packages 27 | .pub-cache/ 28 | .pub/ 29 | build/ 30 | 31 | coverage 32 | 33 | test/_pinning_http2.txt 34 | -------------------------------------------------------------------------------- /plugins/http2_adapter/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 32c946f31bfff6c766229d7b85ef0ae70de2c89a 8 | channel: master 9 | 10 | project_type: package 11 | -------------------------------------------------------------------------------- /plugins/http2_adapter/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Wen Du (wendux) 4 | Copyright (c) 2022 The CFUG Team 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | -------------------------------------------------------------------------------- /plugins/http2_adapter/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: ../../analysis_options.yaml 2 | -------------------------------------------------------------------------------- /plugins/http2_adapter/dart_test.yaml: -------------------------------------------------------------------------------- 1 | file_reporters: 2 | json: build/reports/test-results.json 3 | 4 | presets: 5 | # empty placeholders required in CI scripts 6 | all: 7 | default: 8 | min: 9 | stable: 10 | beta: 11 | 12 | tags: 13 | tls: 14 | skip: "Skipping TLS test with specific setup requirements by default. Use '-P all' to run all tests." 15 | presets: 16 | all: 17 | skip: false 18 | default: 19 | skip: true 20 | proxy: 21 | skip: "Skipping proxy test with specific setup requirements by default. Use '-P all' to run all tests." 22 | presets: 23 | all: 24 | skip: false 25 | default: 26 | skip: true 27 | -------------------------------------------------------------------------------- /plugins/http2_adapter/dio_http2_adapter.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /plugins/http2_adapter/doc/migration_guide.md: -------------------------------------------------------------------------------- 1 | # Migration Guide 2 | 3 | This document gathered all breaking changes and migrations requirement between versions. 4 | 5 | 10 | 11 | ## Breaking versions 12 | 13 | - [2.6.0](#260) 14 | 15 | ## 2.6.0 16 | 17 | ### Summary 18 | 19 | - `ConnectionManager.getConnection` now requires redirection records as a parameter. 20 | 21 | ### Details 22 | 23 | #### `ConnectionManager.getConnection` 24 | 25 | ```diff 26 | /// Get the connection(may reuse) for each request. 27 | Future getConnection( 28 | RequestOptions options, 29 | + List redirects, 30 | ); 31 | ``` 32 | -------------------------------------------------------------------------------- /plugins/http2_adapter/example/example.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | import 'package:dio_http2_adapter/dio_http2_adapter.dart'; 3 | 4 | void main() async { 5 | final dio = Dio() 6 | ..options.baseUrl = 'https://pub.dev' 7 | ..interceptors.add(LogInterceptor()) 8 | ..httpClientAdapter = Http2Adapter( 9 | ConnectionManager(idleTimeout: const Duration(seconds: 10)), 10 | ); 11 | 12 | Response response; 13 | response = await dio.get('/?xx=6'); 14 | for (final e in response.redirects) { 15 | print('redirect: ${e.statusCode} ${e.location}'); 16 | } 17 | print(response.data); 18 | } 19 | -------------------------------------------------------------------------------- /plugins/http2_adapter/lib/dio_http2_adapter.dart: -------------------------------------------------------------------------------- 1 | library dio_http2_adapter; 2 | 3 | export 'src/http2_adapter.dart'; 4 | -------------------------------------------------------------------------------- /plugins/http2_adapter/lib/src/connection_manager.dart: -------------------------------------------------------------------------------- 1 | part of 'http2_adapter.dart'; 2 | 3 | /// {@template dio_http2_adapter.ConnectionManager} 4 | /// Manages the connections that should be reusable. 5 | /// It implements a connection reuse strategy for HTTP/2. 6 | /// {@endtemplate} 7 | abstract class ConnectionManager { 8 | factory ConnectionManager({ 9 | Duration idleTimeout = const Duration(seconds: 15), 10 | void Function(Uri uri, ClientSetting)? onClientCreate, 11 | ProxyConnectedPredicate proxyConnectedPredicate = 12 | defaultProxyConnectedPredicate, 13 | }) => 14 | _ConnectionManager( 15 | idleTimeout: idleTimeout, 16 | onClientCreate: onClientCreate, 17 | proxyConnectedPredicate: proxyConnectedPredicate, 18 | ); 19 | 20 | /// Get the connection(may reuse) for each request. 21 | Future getConnection( 22 | RequestOptions options, 23 | List redirects, 24 | ); 25 | 26 | void removeConnection(ClientTransportConnection transport); 27 | 28 | void close({bool force = false}); 29 | } 30 | 31 | /// {@template dio_http2_adapter.ProxyConnectedPredicate} 32 | /// Checks whether the proxy has been connected through the given [status]. 33 | /// {@endtemplate} 34 | typedef ProxyConnectedPredicate = bool Function(String protocol, String status); 35 | 36 | /// Accepts HTTP/1.x connections for proxies. 37 | bool defaultProxyConnectedPredicate(String protocol, String status) { 38 | return status.startsWith(RegExp(r'HTTP/1+\.\d 200')); 39 | } 40 | -------------------------------------------------------------------------------- /plugins/http2_adapter/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: dio_http2_adapter 2 | version: 2.6.0 3 | 4 | description: An adapter that combines HTTP/2 and dio. Supports reusing connections, header compression, etc. 5 | topics: 6 | - dio 7 | - http2 8 | - native 9 | - network 10 | homepage: https://github.com/cfug/dio 11 | repository: https://github.com/cfug/dio/blob/main/plugins/http2_adapter 12 | issue_tracker: https://github.com/cfug/dio/issues 13 | 14 | environment: 15 | sdk: ">=3.0.0 <4.0.0" 16 | 17 | dependencies: 18 | dio: ^5.2.0 19 | http2: ^2.1.0 20 | meta: ^1.9.1 21 | 22 | dev_dependencies: 23 | lints: any 24 | test: ^1.16.4 25 | crypto: ^3.0.2 26 | path: ^1.8.0 27 | 28 | # Shared test package. 29 | dio_test: 30 | git: 31 | url: https://github.com/cfug/dio 32 | path: dio_test 33 | -------------------------------------------------------------------------------- /plugins/http2_adapter/test/redirect_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio_http2_adapter/dio_http2_adapter.dart'; 2 | import 'package:test/test.dart'; 3 | 4 | void main() { 5 | group('Http2Adapter.resolveRedirectUri', () { 6 | test('empty location', () async { 7 | final current = Uri.parse('https://example.com'); 8 | final result = Http2Adapter.resolveRedirectUri( 9 | current, 10 | Uri.parse(''), 11 | ); 12 | expect(result.toString(), current.toString()); 13 | }); 14 | 15 | test('relative location 1', () async { 16 | final result = Http2Adapter.resolveRedirectUri( 17 | Uri.parse('https://example.com/foo'), 18 | Uri.parse('/bar'), 19 | ); 20 | 21 | expect(result.toString(), 'https://example.com/bar'); 22 | }); 23 | 24 | test('relative location 2', () async { 25 | final result = Http2Adapter.resolveRedirectUri( 26 | Uri.parse('https://example.com/foo'), 27 | Uri.parse('../bar'), 28 | ); 29 | expect(result.toString(), 'https://example.com/bar'); 30 | }); 31 | 32 | test('different location', () async { 33 | final current = Uri.parse('https://example.com/foo'); 34 | final target = 'https://somewhere.com/bar'; 35 | final result = Http2Adapter.resolveRedirectUri( 36 | current, 37 | Uri.parse(target), 38 | ); 39 | expect(result.toString(), target); 40 | }); 41 | }); 42 | } 43 | -------------------------------------------------------------------------------- /plugins/http2_adapter/test/test_suite_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | import 'package:dio_http2_adapter/dio_http2_adapter.dart'; 3 | import 'package:dio_test/tests.dart'; 4 | 5 | void main() { 6 | dioAdapterTestSuite( 7 | (baseUrl) => Dio(BaseOptions(baseUrl: baseUrl)) 8 | ..httpClientAdapter = Http2Adapter(ConnectionManager()), 9 | ); 10 | } 11 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/.gitignore: -------------------------------------------------------------------------------- 1 | # Flutter/Dart/Pub related 2 | **/doc/api/ 3 | **/ios/Flutter/.last_build_id 4 | .dart_tool/ 5 | .flutter-plugins 6 | .flutter-plugins-dependencies 7 | .packages 8 | .pub-cache/ 9 | .pub/ 10 | /build/ 11 | 12 | # IntelliJ related 13 | *.ipr 14 | *.iws 15 | .idea/ 16 | 17 | # Omit committing pubspec.lock for library packages; see 18 | # https://dart.dev/guides/libraries/private-files#pubspeclock. 19 | pubspec.lock 20 | .DS_Store 21 | 22 | coverage 23 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # CHANGELOG 2 | 3 | ## Unreleased 4 | 5 | *None.* 6 | 7 | ## 1.4.0 8 | 9 | - Support `cupertino_http` 2.0.0 10 | 11 | ## 1.3.0 12 | 13 | - Provide fix suggestions for `dart fix`. 14 | - Bump cronet_http version to `>=0.4.0 <=2.0.0`. 15 | 16 | ## 1.2.0 17 | 18 | - Adds `createCronetEngine` and `createCupertinoConfiguration` 19 | to deprecate `cronetEngine` and `cupertinoConfiguration` 20 | for the `NativeAdapter`, to avoid platform exceptions. 21 | - Improve the request stream byte conversion. 22 | 23 | ## 1.1.1 24 | 25 | - Adds the missing `flutter` dependency. 26 | 27 | ## 1.1.0 28 | 29 | - Bump `cronet_http` version. 30 | - Minimal required Dart version is now 3.1. 31 | - Minimal required Flutter version is now 3.13.0. 32 | - Allow case-sensitive header keys with the `preserveHeaderCase` flag through options. 33 | 34 | ## 1.0.0+2 35 | 36 | - Add topics to packages. 37 | 38 | ## 1.0.0+1 39 | 40 | - Update dependencies to make use of stable versions. 41 | - Replace `DioError` with `DioException`. 42 | - Fix `onReceiveProgress` callback. 43 | 44 | ## 0.1.0 45 | 46 | - Bump cupertino_http and cronet_http versions. 47 | - Improve code formats according to linter rules. 48 | 49 | ## 0.0.1 50 | 51 | - Initial version. 52 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: ../../analysis_options.yaml 2 | 3 | analyzer: 4 | language: 5 | strict-raw-types: true 6 | strict-casts: true 7 | strict-inference: true 8 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/.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 | # Symbolication related 36 | app.*.symbols 37 | 38 | # Obfuscation related 39 | app.*.map.json 40 | 41 | # Android Studio will place build artifacts here 42 | /android/app/debug 43 | /android/app/profile 44 | /android/app/release 45 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app 11 | key.properties 12 | **/*.keystore 13 | **/*.jks 14 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.example 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/plugins/native_dio_adapter/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/plugins/native_dio_adapter/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/plugins/native_dio_adapter/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/plugins/native_dio_adapter/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/plugins/native_dio_adapter/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.6.10' 3 | repositories { 4 | google() 5 | mavenCentral() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:7.1.2' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | mavenCentral() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | tasks.register("clean", Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip 6 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties") 4 | def properties = new Properties() 5 | 6 | assert localPropertiesFile.exists() 7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } 8 | 9 | def flutterSdkPath = properties.getProperty("flutter.sdk") 10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" 12 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/ios/.gitignore: -------------------------------------------------------------------------------- 1 | **/dgph 2 | *.mode1v3 3 | *.mode2v3 4 | *.moved-aside 5 | *.pbxuser 6 | *.perspectivev3 7 | **/*sync/ 8 | .sconsign.dblite 9 | .tags* 10 | **/.vagrant/ 11 | **/DerivedData/ 12 | Icon? 13 | **/Pods/ 14 | **/.symlinks/ 15 | profile 16 | xcuserdata 17 | **/.generated/ 18 | Flutter/App.framework 19 | Flutter/Flutter.framework 20 | Flutter/Flutter.podspec 21 | Flutter/Generated.xcconfig 22 | Flutter/ephemeral/ 23 | Flutter/app.flx 24 | Flutter/app.zip 25 | Flutter/flutter_assets/ 26 | Flutter/flutter_export_environment.sh 27 | ServiceDefinitions.json 28 | Runner/GeneratedPluginRegistrant.* 29 | 30 | # Exceptions to above rules. 31 | !default.mode1v3 32 | !default.mode2v3 33 | !default.pbxuser 34 | !default.perspectivev3 35 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 11.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/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 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - cupertino_http (0.0.1): 3 | - Flutter 4 | - Flutter (1.0.0) 5 | 6 | DEPENDENCIES: 7 | - cupertino_http (from `.symlinks/plugins/cupertino_http/ios`) 8 | - Flutter (from `Flutter`) 9 | 10 | EXTERNAL SOURCES: 11 | cupertino_http: 12 | :path: ".symlinks/plugins/cupertino_http/ios" 13 | Flutter: 14 | :path: Flutter 15 | 16 | SPEC CHECKSUMS: 17 | cupertino_http: 5f8b1161107fe6c8d94a0c618735a033d93fa7db 18 | Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 19 | 20 | PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3 21 | 22 | COCOAPODS: 1.11.3 23 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/plugins/native_dio_adapter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/plugins/native_dio_adapter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/plugins/native_dio_adapter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/plugins/native_dio_adapter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/plugins/native_dio_adapter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/plugins/native_dio_adapter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/plugins/native_dio_adapter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/plugins/native_dio_adapter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/plugins/native_dio_adapter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/plugins/native_dio_adapter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/plugins/native_dio_adapter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/plugins/native_dio_adapter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/plugins/native_dio_adapter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/plugins/native_dio_adapter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/plugins/native_dio_adapter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/plugins/native_dio_adapter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/plugins/native_dio_adapter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/plugins/native_dio_adapter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/linux/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral 2 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/linux/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | 10 | void fl_register_plugins(FlPluginRegistry* registry) { 11 | } 12 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/linux/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void fl_register_plugins(FlPluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/linux/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | ) 7 | 8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 9 | jni 10 | ) 11 | 12 | set(PLUGIN_BUNDLED_LIBRARIES) 13 | 14 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 15 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) 16 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 19 | endforeach(plugin) 20 | 21 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 22 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) 23 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 24 | endforeach(ffi_plugin) 25 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/linux/main.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | int main(int argc, char** argv) { 4 | g_autoptr(MyApplication) app = my_application_new(); 5 | return g_application_run(G_APPLICATION(app), argc, argv); 6 | } 7 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/linux/my_application.h: -------------------------------------------------------------------------------- 1 | #ifndef FLUTTER_MY_APPLICATION_H_ 2 | #define FLUTTER_MY_APPLICATION_H_ 3 | 4 | #include 5 | 6 | G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, 7 | GtkApplication) 8 | 9 | /** 10 | * my_application_new: 11 | * 12 | * Creates a new Flutter-based application. 13 | * 14 | * Returns: a new #MyApplication. 15 | */ 16 | MyApplication* my_application_new(); 17 | 18 | #endif // FLUTTER_MY_APPLICATION_H_ 19 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/macos/.gitignore: -------------------------------------------------------------------------------- 1 | # Flutter-related 2 | **/Flutter/ephemeral/ 3 | **/Pods/ 4 | 5 | # Xcode-related 6 | **/dgph 7 | **/xcuserdata/ 8 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/macos/Flutter/Flutter-Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/macos/Flutter/GeneratedPluginRegistrant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | import FlutterMacOS 6 | import Foundation 7 | 8 | 9 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 10 | } 11 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/macos/Podfile: -------------------------------------------------------------------------------- 1 | platform :osx, '10.11' 2 | 3 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 4 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 5 | 6 | project 'Runner', { 7 | 'Debug' => :debug, 8 | 'Profile' => :release, 9 | 'Release' => :release, 10 | } 11 | 12 | def flutter_root 13 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__) 14 | unless File.exist?(generated_xcode_build_settings_path) 15 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first" 16 | end 17 | 18 | File.foreach(generated_xcode_build_settings_path) do |line| 19 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 20 | return matches[1].strip if matches 21 | end 22 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\"" 23 | end 24 | 25 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 26 | 27 | flutter_macos_podfile_setup 28 | 29 | target 'Runner' do 30 | use_frameworks! 31 | use_modular_headers! 32 | 33 | flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) 34 | end 35 | 36 | post_install do |installer| 37 | installer.pods_project.targets.each do |target| 38 | flutter_additional_macos_build_settings(target) 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/macos/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | @NSApplicationMain 5 | class AppDelegate: FlutterAppDelegate { 6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { 7 | return true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/plugins/native_dio_adapter/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/plugins/native_dio_adapter/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/plugins/native_dio_adapter/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/plugins/native_dio_adapter/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/plugins/native_dio_adapter/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/plugins/native_dio_adapter/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/plugins/native_dio_adapter/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/macos/Runner/Configs/AppInfo.xcconfig: -------------------------------------------------------------------------------- 1 | // Application-level settings for the Runner target. 2 | // 3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the 4 | // future. If not, the values below would default to using the project name when this becomes a 5 | // 'flutter create' template. 6 | 7 | // The application's name. By default this is also the title of the Flutter window. 8 | PRODUCT_NAME = example 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = com.example.example 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2022 com.example. All rights reserved. 15 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/macos/Runner/Configs/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Release.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/macos/Runner/Configs/Warnings.xcconfig: -------------------------------------------------------------------------------- 1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings 2 | GCC_WARN_UNDECLARED_SELECTOR = YES 3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES 4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE 5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES 6 | CLANG_WARN_PRAGMA_PACK = YES 7 | CLANG_WARN_STRICT_PROTOTYPES = YES 8 | CLANG_WARN_COMMA = YES 9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES 10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES 11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES 12 | GCC_WARN_SHADOW = YES 13 | CLANG_WARN_UNREACHABLE_CODE = YES 14 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/macos/Runner/DebugProfile.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.cs.allow-jit 8 | 9 | com.apple.security.network.server 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/macos/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | $(PRODUCT_COPYRIGHT) 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/macos/Runner/MainFlutterWindow.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | class MainFlutterWindow: NSWindow { 5 | override func awakeFromNib() { 6 | let flutterViewController = FlutterViewController.init() 7 | let windowFrame = self.frame 8 | self.contentViewController = flutterViewController 9 | self.setFrame(windowFrame, display: true) 10 | 11 | RegisterGeneratedPlugins(registry: flutterViewController) 12 | 13 | super.awakeFromNib() 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/macos/Runner/Release.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: native_dio_adapter_example 2 | publish_to: 'none' 3 | 4 | version: 1.0.0+1 5 | 6 | environment: 7 | sdk: '>=3.1.0 <4.0.0' 8 | 9 | dependencies: 10 | flutter: 11 | sdk: flutter 12 | cupertino_icons: ^1.0.2 13 | dio: ^5.0.0 14 | native_dio_adapter: 15 | path: 16 | ../ 17 | 18 | dev_dependencies: 19 | flutter_test: 20 | sdk: flutter 21 | flutter_lints: ^2.0.0 22 | 23 | flutter: 24 | uses-material-design: true -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/plugins/native_dio_adapter/example/web/favicon.png -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/plugins/native_dio_adapter/example/web/icons/Icon-192.png -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/plugins/native_dio_adapter/example/web/icons/Icon-512.png -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/plugins/native_dio_adapter/example/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/plugins/native_dio_adapter/example/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "example", 3 | "short_name": "example", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "background_color": "#0175C2", 7 | "theme_color": "#0175C2", 8 | "description": "A new Flutter project.", 9 | "orientation": "portrait-primary", 10 | "prefer_related_applications": false, 11 | "icons": [ 12 | { 13 | "src": "icons/Icon-192.png", 14 | "sizes": "192x192", 15 | "type": "image/png" 16 | }, 17 | { 18 | "src": "icons/Icon-512.png", 19 | "sizes": "512x512", 20 | "type": "image/png" 21 | }, 22 | { 23 | "src": "icons/Icon-maskable-192.png", 24 | "sizes": "192x192", 25 | "type": "image/png", 26 | "purpose": "maskable" 27 | }, 28 | { 29 | "src": "icons/Icon-maskable-512.png", 30 | "sizes": "512x512", 31 | "type": "image/png", 32 | "purpose": "maskable" 33 | } 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/windows/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral/ 2 | 3 | # Visual Studio user-specific files. 4 | *.suo 5 | *.user 6 | *.userosscache 7 | *.sln.docstates 8 | 9 | # Visual Studio build-related files. 10 | x64/ 11 | x86/ 12 | 13 | # Visual Studio cache files 14 | # files ending in .cache can be ignored 15 | *.[Cc]ache 16 | # but keep track of directories ending in .cache 17 | !*.[Cc]ache/ 18 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/windows/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | 10 | void RegisterPlugins(flutter::PluginRegistry* registry) { 11 | } 12 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/windows/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void RegisterPlugins(flutter::PluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/windows/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | ) 7 | 8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 9 | jni 10 | ) 11 | 12 | set(PLUGIN_BUNDLED_LIBRARIES) 13 | 14 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 15 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 16 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 19 | endforeach(plugin) 20 | 21 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 22 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) 23 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 24 | endforeach(ffi_plugin) 25 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/windows/runner/flutter_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_FLUTTER_WINDOW_H_ 2 | #define RUNNER_FLUTTER_WINDOW_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include "win32_window.h" 10 | 11 | // A window that does nothing but host a Flutter view. 12 | class FlutterWindow : public Win32Window { 13 | public: 14 | // Creates a new FlutterWindow hosting a Flutter view running |project|. 15 | explicit FlutterWindow(const flutter::DartProject& project); 16 | virtual ~FlutterWindow(); 17 | 18 | protected: 19 | // Win32Window: 20 | bool OnCreate() override; 21 | void OnDestroy() override; 22 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, 23 | LPARAM const lparam) noexcept override; 24 | 25 | private: 26 | // The project to run. 27 | flutter::DartProject project_; 28 | 29 | // The Flutter instance hosted by this window. 30 | std::unique_ptr flutter_controller_; 31 | }; 32 | 33 | #endif // RUNNER_FLUTTER_WINDOW_H_ 34 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/windows/runner/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "flutter_window.h" 6 | #include "utils.h" 7 | 8 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, 9 | _In_ wchar_t *command_line, _In_ int show_command) { 10 | // Attach to console when present (e.g., 'flutter run') or create a 11 | // new console when running with a debugger. 12 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { 13 | CreateAndAttachConsole(); 14 | } 15 | 16 | // Initialize COM, so that it is available for use in the library and/or 17 | // plugins. 18 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); 19 | 20 | flutter::DartProject project(L"data"); 21 | 22 | std::vector command_line_arguments = 23 | GetCommandLineArguments(); 24 | 25 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); 26 | 27 | FlutterWindow window(project); 28 | Win32Window::Point origin(10, 10); 29 | Win32Window::Size size(1280, 720); 30 | if (!window.CreateAndShow(L"example", origin, size)) { 31 | return EXIT_FAILURE; 32 | } 33 | window.SetQuitOnClose(true); 34 | 35 | ::MSG msg; 36 | while (::GetMessage(&msg, nullptr, 0, 0)) { 37 | ::TranslateMessage(&msg); 38 | ::DispatchMessage(&msg); 39 | } 40 | 41 | ::CoUninitialize(); 42 | return EXIT_SUCCESS; 43 | } 44 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/windows/runner/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Runner.rc 4 | // 5 | #define IDI_APP_ICON 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 102 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1001 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfug/dio/808f81b5920e0df3173ce836da340629385722f4/plugins/native_dio_adapter/example/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/windows/runner/runner.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PerMonitorV2 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/example/windows/runner/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_UTILS_H_ 2 | #define RUNNER_UTILS_H_ 3 | 4 | #include 5 | #include 6 | 7 | // Creates a console for the process, and redirects stdout and stderr to 8 | // it for both the runner and the Flutter library. 9 | void CreateAndAttachConsole(); 10 | 11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string 12 | // encoded in UTF-8. Returns an empty std::string on failure. 13 | std::string Utf8FromUtf16(const wchar_t* utf16_string); 14 | 15 | // Gets the command line arguments passed in as a std::vector, 16 | // encoded in UTF-8. Returns an empty std::vector on failure. 17 | std::vector GetCommandLineArguments(); 18 | 19 | #endif // RUNNER_UTILS_H_ 20 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/lib/fix_data/fix.yaml: -------------------------------------------------------------------------------- 1 | version: 1 2 | 3 | transforms: 4 | # Changes made in https://github.com/cfug/dio/pull/2040 5 | - title: "Migrate to create configuration" 6 | date: 2023-11-25 7 | element: 8 | uris: ['native_dio_adapter.dart', 'src/native_adapter.dart'] 9 | constructor: '' 10 | inClass: 'NativeAdapter' 11 | changes: 12 | - kind: 'renameParameter' 13 | oldName: 'androidCronetEngine' 14 | newName: 'createCronetEngine' 15 | - kind: 'renameParameter' 16 | oldName: 'cupertinoConfiguration' 17 | newName: 'createCupertinoConfiguration' 18 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/lib/native_dio_adapter.dart: -------------------------------------------------------------------------------- 1 | library native_dio_adapter; 2 | 3 | export 'package:cronet_http/cronet_http.dart'; 4 | export 'package:cupertino_http/cupertino_http.dart'; 5 | 6 | export 'src/cronet_adapter.dart'; 7 | export 'src/cupertino_adapter.dart'; 8 | export 'src/native_adapter.dart'; 9 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/lib/src/cronet_adapter.dart: -------------------------------------------------------------------------------- 1 | import 'dart:typed_data'; 2 | 3 | import 'package:cronet_http/cronet_http.dart'; 4 | import 'package:dio/dio.dart'; 5 | import 'conversion_layer_adapter.dart'; 6 | 7 | /// A [HttpClientAdapter] for Dio which delegates HTTP requests 8 | /// to the native platform by making use of 9 | /// [cronet_http](https://pub.dev/packages/cronet_http). 10 | class CronetAdapter implements HttpClientAdapter { 11 | CronetAdapter(CronetEngine? engine) 12 | : _conversionLayer = ConversionLayerAdapter( 13 | engine == null 14 | ? CronetClient.defaultCronetEngine() 15 | : CronetClient.fromCronetEngine(engine), 16 | ); 17 | 18 | final ConversionLayerAdapter _conversionLayer; 19 | 20 | @override 21 | void close({bool force = false}) => _conversionLayer.close(force: force); 22 | 23 | @override 24 | Future fetch( 25 | RequestOptions options, 26 | Stream? requestStream, 27 | Future? cancelFuture, 28 | ) => 29 | _conversionLayer.fetch(options, requestStream, cancelFuture); 30 | } 31 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/lib/src/cupertino_adapter.dart: -------------------------------------------------------------------------------- 1 | import 'dart:typed_data'; 2 | 3 | import 'package:cupertino_http/cupertino_http.dart'; 4 | import 'package:dio/dio.dart'; 5 | import 'conversion_layer_adapter.dart'; 6 | 7 | /// A [HttpClientAdapter] for Dio which delegates HTTP requests 8 | /// to the native platform by making use of 9 | /// [cupertino_http](https://pub.dev/packages/cupertino_http). 10 | class CupertinoAdapter implements HttpClientAdapter { 11 | CupertinoAdapter( 12 | URLSessionConfiguration configuration, 13 | ) : _conversionLayer = ConversionLayerAdapter( 14 | CupertinoClient.fromSessionConfiguration(configuration), 15 | ); 16 | 17 | final ConversionLayerAdapter _conversionLayer; 18 | 19 | @override 20 | void close({bool force = false}) => _conversionLayer.close(force: force); 21 | 22 | @override 23 | Future fetch( 24 | RequestOptions options, 25 | Stream? requestStream, 26 | Future? cancelFuture, 27 | ) => 28 | _conversionLayer.fetch(options, requestStream, cancelFuture); 29 | } 30 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: native_dio_adapter 2 | version: 1.4.0 3 | 4 | description: A client for dio which makes use of cupertino_http and cronet_http to delegate HTTP requests to the native platform. 5 | topics: 6 | - dio 7 | - http 8 | - native 9 | - network 10 | - cronet 11 | homepage: https://github.com/cfug/dio 12 | repository: https://github.com/cfug/dio/blob/main/plugins/native_dio_adapter 13 | issue_tracker: https://github.com/cfug/dio/issues 14 | 15 | environment: 16 | sdk: '>=3.1.0 <4.0.0' 17 | flutter: '>=3.13.0' 18 | 19 | dependencies: 20 | flutter: 21 | sdk: flutter 22 | 23 | dio: ^5.4.0 24 | cupertino_http: '>=1.0.0 <3.0.0' 25 | cronet_http: '>=0.4.0 <2.0.0' 26 | http: ^1.0.0 27 | 28 | dev_dependencies: 29 | lints: ^2.0.0 30 | flutter_test: 31 | sdk: flutter 32 | 33 | platforms: 34 | android: 35 | ios: 36 | linux: 37 | macos: 38 | windows: 39 | -------------------------------------------------------------------------------- /plugins/native_dio_adapter/test/client_mock.dart: -------------------------------------------------------------------------------- 1 | import 'package:http/http.dart'; 2 | 3 | class CloseClientMock implements Client { 4 | bool closeWasCalled = false; 5 | 6 | @override 7 | void close() { 8 | closeWasCalled = true; 9 | } 10 | 11 | @override 12 | void noSuchMethod(Invocation invocation) { 13 | throw UnimplementedError(); 14 | } 15 | } 16 | 17 | class ClientMock implements Client { 18 | StreamedResponse? response; 19 | 20 | BaseRequest? request; 21 | 22 | @override 23 | Future send(BaseRequest request) async { 24 | this.request = request; 25 | return response!; 26 | } 27 | 28 | @override 29 | void noSuchMethod(Invocation invocation) { 30 | throw UnimplementedError(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /plugins/web_adapter/.gitignore: -------------------------------------------------------------------------------- 1 | # https://dart.dev/guides/libraries/private-files 2 | # Created by `dart pub` 3 | .dart_tool/ 4 | 5 | # Avoid committing pubspec.lock for library packages; see 6 | # https://dart.dev/guides/libraries/private-files#pubspeclock. 7 | pubspec.lock 8 | -------------------------------------------------------------------------------- /plugins/web_adapter/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # CHANGELOG 2 | 3 | ## Unreleased 4 | 5 | *None.* 6 | 7 | ## 2.1.1 8 | 9 | - Move all source Dart files to `*_impl.dart` to avoid naming collision. 10 | This is a workaround of https://github.com/dart-lang/sdk/issues/56498. 11 | 12 | ## 2.1.0 13 | 14 | - Support `FileAccessMode` in `Dio.download` and `Dio.downloadUri` to change download file opening mode. 15 | 16 | ## 2.0.0 17 | 18 | - Supports the WASM environment. Users should upgrade the adapter with 19 | `dart pub upgrade` or `flutter pub upgrade` to use the WASM-supported version. 20 | 21 | ## 1.0.1 22 | 23 | - Improves warning logs on the Web platform. 24 | 25 | ## 1.0.0 26 | 27 | - Split the Web ability from the `package:dio`. 28 | -------------------------------------------------------------------------------- /plugins/web_adapter/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Wen Du (wendux) 4 | Copyright (c) 2022 The CFUG Team 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. -------------------------------------------------------------------------------- /plugins/web_adapter/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: ../../analysis_options.yaml 2 | 3 | linter: 4 | rules: 5 | implementation_imports: false 6 | -------------------------------------------------------------------------------- /plugins/web_adapter/dart_test.yaml: -------------------------------------------------------------------------------- 1 | presets: 2 | # empty placeholders required in CI scripts 3 | all: 4 | default: 5 | min: 6 | stable: 7 | beta: 8 | 9 | override_platforms: 10 | chrome: 11 | settings: 12 | headless: true 13 | firefox: 14 | settings: 15 | # headless argument has to be set explicitly for non-chrome browsers 16 | arguments: --headless 17 | executable: 18 | # https://github.com/dart-lang/test/pull/2195 19 | mac_os: '/Applications/Firefox.app/Contents/MacOS/firefox' 20 | -------------------------------------------------------------------------------- /plugins/web_adapter/dio_web_adapter.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /plugins/web_adapter/example/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | import 'package:dio_web_adapter/dio_web_adapter.dart'; 3 | 4 | void main() { 5 | final dio = Dio(); 6 | dio.httpClientAdapter = BrowserHttpClientAdapter(withCredentials: true); 7 | dio.interceptors.add(LogInterceptor()); 8 | dio.get('https://httpbun.com/status/200'); 9 | } 10 | -------------------------------------------------------------------------------- /plugins/web_adapter/lib/dio_web_adapter.dart: -------------------------------------------------------------------------------- 1 | library dio_web_adapter; 2 | 3 | export 'src/adapter_impl.dart'; 4 | export 'src/compute_impl.dart'; 5 | export 'src/dio_impl.dart'; 6 | export 'src/multipart_file_impl.dart'; 7 | export 'src/progress_stream_impl.dart'; 8 | -------------------------------------------------------------------------------- /plugins/web_adapter/lib/src/adapter.dart: -------------------------------------------------------------------------------- 1 | @Deprecated( 2 | 'Import adapter_impl.dart instead. ' 3 | 'See https://github.com/dart-lang/sdk/issues/56498', 4 | ) 5 | export 'adapter_impl.dart'; 6 | -------------------------------------------------------------------------------- /plugins/web_adapter/lib/src/compute.dart: -------------------------------------------------------------------------------- 1 | @Deprecated( 2 | 'Import compute_impl.dart instead. ' 3 | 'See https://github.com/dart-lang/sdk/issues/56498', 4 | ) 5 | export 'compute_impl.dart'; 6 | -------------------------------------------------------------------------------- /plugins/web_adapter/lib/src/dio_impl.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | 3 | import 'adapter_impl.dart'; 4 | 5 | /// Create the [Dio] instance for Web platforms. 6 | Dio createDio([BaseOptions? options]) => DioForBrowser(options); 7 | 8 | /// Implements features for [Dio] on Web platforms. 9 | class DioForBrowser with DioMixin implements Dio { 10 | /// Create Dio instance with default [Options]. 11 | /// It's mostly just one Dio instance in your application. 12 | DioForBrowser([BaseOptions? baseOptions]) { 13 | options = baseOptions ?? BaseOptions(); 14 | httpClientAdapter = BrowserHttpClientAdapter(); 15 | } 16 | 17 | @override 18 | Future download( 19 | String urlPath, 20 | dynamic savePath, { 21 | ProgressCallback? onReceiveProgress, 22 | Map? queryParameters, 23 | CancelToken? cancelToken, 24 | bool deleteOnError = true, 25 | FileAccessMode fileAccessMode = FileAccessMode.write, 26 | String lengthHeader = Headers.contentLengthHeader, 27 | Object? data, 28 | Options? options, 29 | }) { 30 | throw UnsupportedError( 31 | 'The download method is not available in the Web environment.', 32 | ); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /plugins/web_adapter/lib/src/multipart_file.dart: -------------------------------------------------------------------------------- 1 | @Deprecated( 2 | 'Import multipart_file_impl.dart instead. ' 3 | 'See https://github.com/dart-lang/sdk/issues/56498', 4 | ) 5 | export 'multipart_file_impl.dart'; 6 | -------------------------------------------------------------------------------- /plugins/web_adapter/lib/src/multipart_file_impl.dart: -------------------------------------------------------------------------------- 1 | import 'package:http_parser/http_parser.dart'; 2 | 3 | final _err = UnsupportedError( 4 | 'MultipartFile is only supported where dart:io is available.', 5 | ); 6 | 7 | Never multipartFileFromPath( 8 | String filePath, { 9 | String? filename, 10 | MediaType? contentType, 11 | final Map>? headers, 12 | }) => 13 | throw _err; 14 | 15 | Never multipartFileFromPathSync( 16 | String filePath, { 17 | String? filename, 18 | MediaType? contentType, 19 | final Map>? headers, 20 | }) => 21 | throw _err; 22 | -------------------------------------------------------------------------------- /plugins/web_adapter/lib/src/progress_stream.dart: -------------------------------------------------------------------------------- 1 | @Deprecated( 2 | 'Import progress_stream_impl.dart instead. ' 3 | 'See https://github.com/dart-lang/sdk/issues/56498', 4 | ) 5 | export 'progress_stream_impl.dart'; 6 | -------------------------------------------------------------------------------- /plugins/web_adapter/lib/src/progress_stream_impl.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:typed_data'; 3 | 4 | import 'package:dio/dio.dart'; 5 | 6 | Stream addProgress( 7 | Stream> stream, 8 | int? length, 9 | RequestOptions options, 10 | ) { 11 | if (stream is Stream) { 12 | return stream; 13 | } 14 | final streamTransformer = _transform>(stream, length, options); 15 | return stream.transform(streamTransformer); 16 | } 17 | 18 | StreamTransformer _transform>( 19 | Stream stream, 20 | int? length, 21 | RequestOptions options, 22 | ) { 23 | return StreamTransformer.fromHandlers( 24 | handleData: (S data, sink) { 25 | final cancelToken = options.cancelToken; 26 | if (cancelToken != null && cancelToken.isCancelled) { 27 | cancelToken.requestOptions = options; 28 | sink 29 | ..addError(cancelToken.cancelError!) 30 | ..close(); 31 | } else { 32 | if (data is Uint8List) { 33 | sink.add(data); 34 | } else { 35 | sink.add(Uint8List.fromList(data)); 36 | } 37 | } 38 | }, 39 | ); 40 | } 41 | -------------------------------------------------------------------------------- /plugins/web_adapter/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: dio_web_adapter 2 | version: 2.1.1 3 | 4 | description: An adapter that supports Dio on Web. 5 | topics: 6 | - dio 7 | - http 8 | - network 9 | - web 10 | - wasm 11 | homepage: https://github.com/cfug/dio 12 | repository: https://github.com/cfug/dio/blob/main/plugins/web_adapter 13 | issue_tracker: https://github.com/cfug/dio/issues 14 | 15 | environment: 16 | sdk: ^3.3.0 17 | 18 | dependencies: 19 | dio: ^5.8.0 20 | http_parser: ^4.0.0 21 | meta: ^1.5.0 22 | web: '>=0.5.0 <2.0.0' 23 | 24 | dev_dependencies: 25 | lints: any 26 | test: ^1.5.0 27 | -------------------------------------------------------------------------------- /plugins/web_adapter/test/browser_test.dart: -------------------------------------------------------------------------------- 1 | @TestOn('browser') 2 | import 'dart:typed_data'; 3 | 4 | import 'package:dio/browser.dart'; 5 | import 'package:dio/dio.dart'; 6 | import 'package:test/test.dart'; 7 | 8 | void main() { 9 | test('with credentials', () async { 10 | final browserAdapter = BrowserHttpClientAdapter(withCredentials: true); 11 | final opts = RequestOptions(); 12 | final testStream = Stream.periodic( 13 | const Duration(seconds: 1), 14 | (x) => Uint8List(x), 15 | ); 16 | final cancelFuture = opts.cancelToken?.whenCancel; 17 | 18 | browserAdapter.fetch(opts, testStream, cancelFuture); 19 | expect(browserAdapter.xhrs.every((e) => e.withCredentials == true), isTrue); 20 | }); 21 | } 22 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: dio_workspace 2 | publish_to: 'none' 3 | repository: https://github.com/cfug/dio 4 | 5 | environment: 6 | sdk: '>=2.18.0 <4.0.0' 7 | 8 | dev_dependencies: 9 | lints: any 10 | melos: any 11 | cli_util: any # Required by custom melos command. 12 | path: any # Required by custom melos command. 13 | pub_semver: any # Required by custom melos command. 14 | yaml: any # Required by custom melos command. 15 | -------------------------------------------------------------------------------- /scripts/prepare_pinning_certs.sh: -------------------------------------------------------------------------------- 1 | # For dio pinning tests 2 | openssl s_client \ 3 | -servername badssl.com \ 4 | -connect badssl.com:443 < /dev/null 2>/dev/null \ 5 | | openssl x509 -noout -fingerprint -sha256 > dio/test/_pinning.txt 2>/dev/null 6 | 7 | # For http2_adapter pinning tests 8 | openssl s_client \ 9 | -servername httpbun.com \ 10 | -connect httpbun.com:443 < /dev/null 2>/dev/null \ 11 | | openssl x509 -noout -fingerprint -sha256 > plugins/http2_adapter/test/_pinning_http2.txt 2>/dev/null 12 | --------------------------------------------------------------------------------