├── .github └── workflows │ └── main.yml ├── .gitignore ├── Makefile ├── README.md ├── flutter_charset_detector ├── .metadata ├── CHANGELOG.md ├── LICENSE ├── README.md ├── analysis_options.yaml ├── example │ ├── .gitignore │ ├── .metadata │ ├── README.md │ ├── analysis_options.yaml │ ├── android │ │ ├── .gitignore │ │ ├── app │ │ │ ├── build.gradle │ │ │ └── src │ │ │ │ ├── debug │ │ │ │ └── AndroidManifest.xml │ │ │ │ ├── main │ │ │ │ ├── AndroidManifest.xml │ │ │ │ ├── kotlin │ │ │ │ │ └── com │ │ │ │ │ │ └── madlonkay │ │ │ │ │ │ └── flutter_charset_detector_example │ │ │ │ │ │ └── MainActivity.kt │ │ │ │ └── res │ │ │ │ │ ├── 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 │ │ │ │ │ └── styles.xml │ │ │ │ └── profile │ │ │ │ └── AndroidManifest.xml │ │ ├── build.gradle │ │ ├── gradle.properties │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ └── gradle-wrapper.properties │ │ └── settings.gradle │ ├── assets │ │ └── sjis-example.txt │ ├── 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 │ ├── macos │ │ ├── .gitignore │ │ ├── Flutter │ │ │ ├── Flutter-Debug.xcconfig │ │ │ ├── Flutter-Release.xcconfig │ │ │ └── GeneratedPluginRegistrant.swift │ │ ├── Podfile │ │ ├── Podfile.lock │ │ ├── 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.lock │ ├── pubspec.yaml │ ├── test │ │ └── widget_test.dart │ └── web │ │ ├── favicon.png │ │ ├── icons │ │ ├── Icon-192.png │ │ ├── Icon-512.png │ │ ├── Icon-maskable-192.png │ │ └── Icon-maskable-512.png │ │ ├── index.html │ │ └── manifest.json ├── lib │ └── flutter_charset_detector.dart ├── pubspec.lock ├── pubspec.yaml └── test │ └── flutter_charset_detector_test.dart ├── flutter_charset_detector_android ├── .metadata ├── CHANGELOG.md ├── LICENSE ├── README.md ├── analysis_options.yaml ├── android │ ├── .gitignore │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ ├── settings.gradle │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ └── kotlin │ │ └── com │ │ └── madlonkay │ │ └── flutter_charset_detector │ │ └── FlutterCharsetDetectorPlugin.kt ├── lib │ └── flutter_charset_detector_android.dart ├── pubspec.lock └── pubspec.yaml ├── flutter_charset_detector_darwin ├── .metadata ├── CHANGELOG.md ├── LICENSE ├── README.md ├── analysis_options.yaml ├── darwin │ ├── .gitignore │ ├── Assets │ │ └── .gitkeep │ ├── Classes │ │ ├── FlutterCharsetDetectorPlugin.h │ │ ├── FlutterCharsetDetectorPlugin.m │ │ └── SwiftFlutterCharsetDetectorPlugin.swift │ └── flutter_charset_detector_darwin.podspec ├── lib │ └── flutter_charset_detector_darwin.dart ├── pubspec.lock └── pubspec.yaml ├── flutter_charset_detector_platform_interface ├── .metadata ├── CHANGELOG.md ├── LICENSE ├── README.md ├── analysis_options.yaml ├── lib │ ├── decoding_result.dart │ ├── flutter_charset_detector_platform_interface.dart │ └── src │ │ └── method_channel_charset_detector.dart ├── pubspec.lock └── pubspec.yaml └── flutter_charset_detector_web ├── .gitignore ├── .metadata ├── CHANGELOG.md ├── LICENSE ├── README.md ├── analysis_options.yaml ├── example ├── .gitignore ├── README.md ├── analysis_options.yaml ├── lib │ └── main.dart ├── pubspec.lock ├── pubspec.yaml └── web │ ├── favicon.png │ ├── icons │ ├── Icon-192.png │ ├── Icon-512.png │ ├── Icon-maskable-192.png │ └── Icon-maskable-512.png │ ├── index.html │ └── manifest.json ├── lib ├── assets │ └── web │ │ └── jschardet.min.js ├── flutter_charset_detector_web.dart ├── js_charset_detector.dart └── js_textdecoder.dart └── pubspec.yaml /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: Flutter CI 2 | 3 | on: 4 | push: 5 | branches: [ master ] 6 | pull_request: 7 | branches: [ master ] 8 | 9 | jobs: 10 | build: 11 | 12 | runs-on: ubuntu-latest 13 | 14 | steps: 15 | - uses: actions/checkout@v2 16 | - uses: subosito/flutter-action@v1 17 | with: 18 | channel: 'beta' 19 | - name: Install dependencies 20 | run: make deps 21 | - name: Analyze 22 | run: make analyze 23 | - name: Run tests 24 | run: make test 25 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .dart_tool/ 3 | 4 | .packages 5 | .pub/ 6 | 7 | build/ 8 | 9 | .idea 10 | 11 | *~ 12 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | do_all_projects = for p in flutter_charset_detector*; do (cd $$p && $(1)); done 2 | jschardet_version := v3.1.0 3 | jschardet_url := https://raw.githubusercontent.com/aadsm/jschardet/$(jschardet_version)/dist/jschardet.min.js 4 | jschardet := flutter_charset_detector_web/lib/assets/web/jschardet.min.js 5 | 6 | .PHONY: deps 7 | deps: ## Fetch deps in all subprojects 8 | $(call do_all_projects,flutter pub get $(args)) 9 | 10 | .PHONY: outdated 11 | outdated: ## Check outdated deps in all subprojects 12 | $(call do_all_projects,flutter pub outdated $(args)) 13 | 14 | .PHONY: upgrade 15 | upgrade: ## Upgrade deps in all subprojects 16 | $(call do_all_projects,flutter pub upgrade $(args)) 17 | 18 | .PHONY: analyze 19 | analyze: ## Run analysis in all subprojects 20 | flutter analyze flutter_charset_detector* 21 | 22 | .PHONY: test 23 | test: ## Run tests in all subprojects 24 | for t in flutter_charset_detector*/test flutter_charset_detector*/*/test; do (cd $$t/.. && flutter test); done 25 | 26 | .PHONY: assets 27 | assets: ## Download vendor assets 28 | assets: $(jschardet) 29 | 30 | $(jschardet): 31 | mkdir -p $(@D) 32 | curl -o $(@) $(jschardet_url) 33 | 34 | .PHONY: clobber 35 | clobber: ## Delete all vendor files 36 | clobber: 37 | rm -rf $(jschardet) 38 | 39 | .PHONY: help 40 | help: ## Show this help text 41 | $(info usage: make [target]) 42 | $(info ) 43 | $(info Available targets:) 44 | @awk -F ':.*?## *' '/^[^\t].+?:.*?##/ \ 45 | {printf " %-24s %s\n", $$1, $$2}' $(MAKEFILE_LIST) 46 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | flutter_charset_detector/README.md -------------------------------------------------------------------------------- /flutter_charset_detector/.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: 81a45ec2e5f80fa71d5135f1702ce540558b416d 8 | channel: beta 9 | 10 | project_type: plugin 11 | -------------------------------------------------------------------------------- /flutter_charset_detector/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 5.0.0 2 | 3 | * Web implementation now requires Dart 3.3+ 4 | 5 | ## 4.0.0 6 | 7 | * Android implementation now requires SDK 21 8 | 9 | ## 3.1.0 10 | 11 | * Add `detect` method to obtain the detected charset without decoding the 12 | supplied bytes 13 | 14 | ## 3.0.0 15 | 16 | * Add macOS implementation 17 | * iOS implementation now requires iOS 11+ 18 | 19 | ## 2.1.0 20 | 21 | * Add web implementation 22 | 23 | ## 2.0.0 24 | 25 | * Drop older Android Gradle Plugin support 26 | 27 | ## 1.0.2 28 | 29 | * Migrate to federated architecture 30 | 31 | ## 1.0.1 32 | 33 | * Fix incompatibility with Kotlin <1.3.70 34 | ([#1](https://github.com/amake/flutter_charset_detector/issues/1)) 35 | 36 | ## 1.0.0 37 | 38 | * Migrate to non-nullable by default 39 | 40 | ## 0.3.0 41 | 42 | * Update Android detection library 43 | * juniversalchardet 2.4.0 44 | 45 | ## 0.2.0 46 | 47 | * Update iOS detection library 48 | * UniversalDetector2 2.0.0 (uchardet 0.0.7) 49 | 50 | ## 0.1.1 51 | 52 | * Fleshed out package description 53 | 54 | ## 0.1.0 55 | 56 | * Rename `DecodingResult.encoding` to `.charset` 57 | * `DecodingResult.fromJson` constructor is now private 58 | * Document public APIs 59 | 60 | ## 0.0.1 61 | 62 | * Initial release 63 | * juniversalchardet 2.3.2 64 | * UniversalDetector 1.4.0 (uchardet pre-0.0.2 (84e292)) 65 | -------------------------------------------------------------------------------- /flutter_charset_detector/README.md: -------------------------------------------------------------------------------- 1 | # flutter_charset_detector 2 | 3 | Automatically detect and decode the charset (character encoding) of text bytes. 4 | 5 | 6 | 7 | _The example app; [details](./example/README.md)_ 8 | 9 | This plugin uses native libraries derived from the universal charset detection 10 | libraries created by Mozilla. 11 | 12 | - iOS, macOS: 13 | [UniversalDetector2](https://cocoapods.org/pods/UniversalDetector2), a thin 14 | wrapper around [uchardet](https://www.freedesktop.org/wiki/Software/uchardet/) 15 | - Android: 16 | [juniversalchardet](https://github.com/albfernandez/juniversalchardet), a Java 17 | implementation of universalchardet 18 | - Web: [jschardet](https://github.com/aadsm/jschardet), a JavaScript port of the 19 | Python [chardet](https://github.com/chardet/chardet) 20 | 21 | ## Supported platforms 22 | 23 | - Android 4.1 (SDK 16) and higher 24 | - iOS 11 and higher 25 | - macOS 10.14 and higher 26 | - Web (requires [TextDecoder](https://caniuse.com/textencoder) support) 27 | 28 | ## Supported charsets 29 | 30 | The detectable charsets differ by platform according to the capabilities of the 31 | underlying library; for specifics see: 32 | 33 | - [iOS, macOS](https://gitlab.freedesktop.org/uchardet/uchardet/-/blob/v0.0.8/README.md#supported-languagesencodings) 34 | - [Android](https://github.com/albfernandez/juniversalchardet/blob/v2.5.0/README.md#encodings-that-can-be-detected) 35 | - [Web](https://github.com/aadsm/jschardet/blob/v3.1.0/README.md#supported-charsets) 36 | 37 | ## Setup 38 | 39 | - [Web](https://github.com/amake/flutter_charset_detector/tree/master/flutter_charset_detector_web#usage) 40 | - Others: no special setup required 41 | 42 | ## Usage 43 | 44 | ```dart 45 | import 'package:flutter_charset_detector/flutter_charset_detector.dart'; 46 | 47 | Uint8List bytes = getBytes(); // bytes with unknown encoding 48 | DecodingResult result = CharsetDetector.autoDecode(bytes); 49 | print(result.charset); // => e.g. 'SHIFT_JIS' 50 | print(result.string); // => e.g. '日本語' 51 | ``` 52 | 53 | ## See also 54 | 55 | - [charset_converter](https://pub.dev/packages/charset_converter) if you already 56 | know the name of the charset you want to encode/decode 57 | -------------------------------------------------------------------------------- /flutter_charset_detector/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:flutter_lints/flutter.yaml 2 | 3 | analyzer: 4 | language: 5 | strict-casts: true 6 | strict-inference: true 7 | strict-raw-types: true 8 | -------------------------------------------------------------------------------- /flutter_charset_detector/example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | **/ios/Flutter/.last_build_id 26 | .dart_tool/ 27 | .flutter-plugins 28 | .flutter-plugins-dependencies 29 | .packages 30 | .pub-cache/ 31 | .pub/ 32 | /build/ 33 | 34 | # Web related 35 | lib/generated_plugin_registrant.dart 36 | 37 | # Symbolication related 38 | app.*.symbols 39 | 40 | # Obfuscation related 41 | app.*.map.json 42 | -------------------------------------------------------------------------------- /flutter_charset_detector/example/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: "1751123cde4ffad08ae27bdee4f8ddebd033fe76" 8 | channel: "beta" 9 | 10 | project_type: app 11 | 12 | # Tracks metadata for the flutter migrate command 13 | migration: 14 | platforms: 15 | - platform: root 16 | create_revision: 1751123cde4ffad08ae27bdee4f8ddebd033fe76 17 | base_revision: 1751123cde4ffad08ae27bdee4f8ddebd033fe76 18 | - platform: macos 19 | create_revision: 1751123cde4ffad08ae27bdee4f8ddebd033fe76 20 | base_revision: 1751123cde4ffad08ae27bdee4f8ddebd033fe76 21 | 22 | # User provided section 23 | 24 | # List of Local paths (relative to this file) that should be 25 | # ignored by the migrate tool. 26 | # 27 | # Files that are not part of the templates will be ignored by default. 28 | unmanaged_files: 29 | - 'lib/main.dart' 30 | - 'ios/Runner.xcodeproj/project.pbxproj' 31 | -------------------------------------------------------------------------------- /flutter_charset_detector/example/README.md: -------------------------------------------------------------------------------- 1 | # flutter_charset_detector_example 2 | 3 | Demonstrates how to use the flutter_charset_detector plugin. 4 | 5 | 6 | 7 | The app loads an asset file encoded in 8 | [Shift-JIS](https://en.wikipedia.org/wiki/Shift_JIS) in three ways from top to 9 | bottom: 10 | 11 | 1. Using the default charset: Flutter's various load mechanisms by default 12 | assume UTF-8, and fail if there are unrepresentable characters 13 | 2. Using UTF-8 with "allow malformed": Interpret the bytes as UTF-8 and replace 14 | any unrepresentable characters with U+FFFD (�) 15 | 3. With auto-detection through `CharsetDetector.autoDecode`: the result includes 16 | the detected charset and the decoded string 17 | -------------------------------------------------------------------------------- /flutter_charset_detector/example/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:flutter_lints/flutter.yaml 2 | 3 | linter: 4 | rules: 5 | -------------------------------------------------------------------------------- /flutter_charset_detector/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 | -------------------------------------------------------------------------------- /flutter_charset_detector/example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id "com.android.application" 3 | id "kotlin-android" 4 | id "dev.flutter.flutter-gradle-plugin" 5 | } 6 | 7 | def localProperties = new Properties() 8 | def localPropertiesFile = rootProject.file('local.properties') 9 | if (localPropertiesFile.exists()) { 10 | localPropertiesFile.withReader('UTF-8') { reader -> 11 | localProperties.load(reader) 12 | } 13 | } 14 | 15 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 16 | if (flutterVersionCode == null) { 17 | flutterVersionCode = '1' 18 | } 19 | 20 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 21 | if (flutterVersionName == null) { 22 | flutterVersionName = '1.0' 23 | } 24 | 25 | android { 26 | namespace 'com.madlonkay.flutter_charset_detector_example' 27 | compileSdk flutter.compileSdkVersion 28 | 29 | sourceSets { 30 | main.java.srcDirs += 'src/main/kotlin' 31 | } 32 | 33 | defaultConfig { 34 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 35 | applicationId "com.madlonkay.flutter_charset_detector_example" 36 | minSdkVersion flutter.minSdkVersion 37 | targetSdkVersion flutter.targetSdkVersion 38 | versionCode flutterVersionCode.toInteger() 39 | versionName flutterVersionName 40 | } 41 | 42 | buildTypes { 43 | release { 44 | // TODO: Add your own signing config for the release build. 45 | // Signing with the debug keys for now, so `flutter run --release` works. 46 | signingConfig signingConfigs.debug 47 | } 48 | } 49 | } 50 | 51 | flutter { 52 | source '../..' 53 | } 54 | 55 | dependencies {} 56 | -------------------------------------------------------------------------------- /flutter_charset_detector/example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /flutter_charset_detector/example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 14 | 18 | 22 | 27 | 31 | 32 | 33 | 34 | 35 | 36 | 38 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /flutter_charset_detector/example/android/app/src/main/kotlin/com/madlonkay/flutter_charset_detector_example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.madlonkay.flutter_charset_detector_example 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /flutter_charset_detector/example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /flutter_charset_detector/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amake/flutter_charset_detector/5d32e065b12bd48765db9122f99e20af8bbab5c1/flutter_charset_detector/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /flutter_charset_detector/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amake/flutter_charset_detector/5d32e065b12bd48765db9122f99e20af8bbab5c1/flutter_charset_detector/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /flutter_charset_detector/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amake/flutter_charset_detector/5d32e065b12bd48765db9122f99e20af8bbab5c1/flutter_charset_detector/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /flutter_charset_detector/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amake/flutter_charset_detector/5d32e065b12bd48765db9122f99e20af8bbab5c1/flutter_charset_detector/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /flutter_charset_detector/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amake/flutter_charset_detector/5d32e065b12bd48765db9122f99e20af8bbab5c1/flutter_charset_detector/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /flutter_charset_detector/example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /flutter_charset_detector/example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /flutter_charset_detector/example/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 | -------------------------------------------------------------------------------- /flutter_charset_detector/example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | android.defaults.buildfeatures.buildconfig=true 5 | android.nonTransitiveRClass=false 6 | android.nonFinalResIds=false 7 | -------------------------------------------------------------------------------- /flutter_charset_detector/example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /flutter_charset_detector/example/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.1" apply false 22 | id "org.jetbrains.kotlin.android" version "1.7.10" apply false 23 | } 24 | 25 | include ":app" 26 | -------------------------------------------------------------------------------- /flutter_charset_detector/example/assets/sjis-example.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amake/flutter_charset_detector/5d32e065b12bd48765db9122f99e20af8bbab5c1/flutter_charset_detector/example/assets/sjis-example.txt -------------------------------------------------------------------------------- /flutter_charset_detector/example/ios/.gitignore: -------------------------------------------------------------------------------- 1 | *.mode1v3 2 | *.mode2v3 3 | *.moved-aside 4 | *.pbxuser 5 | *.perspectivev3 6 | **/*sync/ 7 | .sconsign.dblite 8 | .tags* 9 | **/.vagrant/ 10 | **/DerivedData/ 11 | Icon? 12 | **/Pods/ 13 | **/.symlinks/ 14 | profile 15 | xcuserdata 16 | **/.generated/ 17 | Flutter/App.framework 18 | Flutter/Flutter.framework 19 | Flutter/Flutter.podspec 20 | Flutter/Generated.xcconfig 21 | Flutter/app.flx 22 | Flutter/app.zip 23 | Flutter/flutter_assets/ 24 | Flutter/flutter_export_environment.sh 25 | ServiceDefinitions.json 26 | Runner/GeneratedPluginRegistrant.* 27 | 28 | # Exceptions to above rules. 29 | !default.mode1v3 30 | !default.mode2v3 31 | !default.pbxuser 32 | !default.perspectivev3 33 | -------------------------------------------------------------------------------- /flutter_charset_detector/example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 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 | -------------------------------------------------------------------------------- /flutter_charset_detector/example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /flutter_charset_detector/example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /flutter_charset_detector/example/ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '12.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | project 'Runner', { 8 | 'Debug' => :debug, 9 | 'Profile' => :release, 10 | 'Release' => :release, 11 | } 12 | 13 | def flutter_root 14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) 15 | unless File.exist?(generated_xcode_build_settings_path) 16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" 17 | end 18 | 19 | File.foreach(generated_xcode_build_settings_path) do |line| 20 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 21 | return matches[1].strip if matches 22 | end 23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" 24 | end 25 | 26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 27 | 28 | flutter_ios_podfile_setup 29 | 30 | target 'Runner' do 31 | use_frameworks! 32 | use_modular_headers! 33 | 34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) 35 | end 36 | 37 | post_install do |installer| 38 | installer.pods_project.targets.each do |target| 39 | flutter_additional_ios_build_settings(target) 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /flutter_charset_detector/example/ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Flutter (1.0.0) 3 | - flutter_charset_detector_darwin (0.0.1): 4 | - Flutter 5 | - FlutterMacOS 6 | - UniversalDetector2 (= 2.0.1) 7 | - UniversalDetector2 (2.0.1) 8 | 9 | DEPENDENCIES: 10 | - Flutter (from `Flutter`) 11 | - flutter_charset_detector_darwin (from `.symlinks/plugins/flutter_charset_detector_darwin/darwin`) 12 | 13 | SPEC REPOS: 14 | trunk: 15 | - UniversalDetector2 16 | 17 | EXTERNAL SOURCES: 18 | Flutter: 19 | :path: Flutter 20 | flutter_charset_detector_darwin: 21 | :path: ".symlinks/plugins/flutter_charset_detector_darwin/darwin" 22 | 23 | SPEC CHECKSUMS: 24 | Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 25 | flutter_charset_detector_darwin: fb3692d6d72cb6afcce7b0dd1a9516be6e78556e 26 | UniversalDetector2: 7c9ffd935cf050eeb19edf7e90f6febe3743a1af 27 | 28 | PODFILE CHECKSUM: c4c93c5f6502fe2754f48404d3594bf779584011 29 | 30 | COCOAPODS: 1.14.3 31 | -------------------------------------------------------------------------------- /flutter_charset_detector/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /flutter_charset_detector/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /flutter_charset_detector/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /flutter_charset_detector/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /flutter_charset_detector/example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /flutter_charset_detector/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /flutter_charset_detector/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /flutter_charset_detector/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 | -------------------------------------------------------------------------------- /flutter_charset_detector/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /flutter_charset_detector/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amake/flutter_charset_detector/5d32e065b12bd48765db9122f99e20af8bbab5c1/flutter_charset_detector/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /flutter_charset_detector/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amake/flutter_charset_detector/5d32e065b12bd48765db9122f99e20af8bbab5c1/flutter_charset_detector/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /flutter_charset_detector/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amake/flutter_charset_detector/5d32e065b12bd48765db9122f99e20af8bbab5c1/flutter_charset_detector/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /flutter_charset_detector/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amake/flutter_charset_detector/5d32e065b12bd48765db9122f99e20af8bbab5c1/flutter_charset_detector/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /flutter_charset_detector/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amake/flutter_charset_detector/5d32e065b12bd48765db9122f99e20af8bbab5c1/flutter_charset_detector/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /flutter_charset_detector/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amake/flutter_charset_detector/5d32e065b12bd48765db9122f99e20af8bbab5c1/flutter_charset_detector/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /flutter_charset_detector/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amake/flutter_charset_detector/5d32e065b12bd48765db9122f99e20af8bbab5c1/flutter_charset_detector/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /flutter_charset_detector/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amake/flutter_charset_detector/5d32e065b12bd48765db9122f99e20af8bbab5c1/flutter_charset_detector/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /flutter_charset_detector/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amake/flutter_charset_detector/5d32e065b12bd48765db9122f99e20af8bbab5c1/flutter_charset_detector/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /flutter_charset_detector/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amake/flutter_charset_detector/5d32e065b12bd48765db9122f99e20af8bbab5c1/flutter_charset_detector/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /flutter_charset_detector/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amake/flutter_charset_detector/5d32e065b12bd48765db9122f99e20af8bbab5c1/flutter_charset_detector/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /flutter_charset_detector/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amake/flutter_charset_detector/5d32e065b12bd48765db9122f99e20af8bbab5c1/flutter_charset_detector/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /flutter_charset_detector/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amake/flutter_charset_detector/5d32e065b12bd48765db9122f99e20af8bbab5c1/flutter_charset_detector/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /flutter_charset_detector/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amake/flutter_charset_detector/5d32e065b12bd48765db9122f99e20af8bbab5c1/flutter_charset_detector/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /flutter_charset_detector/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amake/flutter_charset_detector/5d32e065b12bd48765db9122f99e20af8bbab5c1/flutter_charset_detector/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /flutter_charset_detector/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 | -------------------------------------------------------------------------------- /flutter_charset_detector/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amake/flutter_charset_detector/5d32e065b12bd48765db9122f99e20af8bbab5c1/flutter_charset_detector/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /flutter_charset_detector/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amake/flutter_charset_detector/5d32e065b12bd48765db9122f99e20af8bbab5c1/flutter_charset_detector/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /flutter_charset_detector/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amake/flutter_charset_detector/5d32e065b12bd48765db9122f99e20af8bbab5c1/flutter_charset_detector/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /flutter_charset_detector/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. -------------------------------------------------------------------------------- /flutter_charset_detector/example/ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /flutter_charset_detector/example/ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /flutter_charset_detector/example/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | flutter_charset_detector_example 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(FLUTTER_BUILD_NAME) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UIViewControllerBasedStatusBarAppearance 43 | 44 | CADisableMinimumFrameDurationOnPhone 45 | 46 | UIApplicationSupportsIndirectInputEvents 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /flutter_charset_detector/example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /flutter_charset_detector/example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:convert'; 3 | 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter/services.dart'; 6 | import 'package:flutter_charset_detector/flutter_charset_detector.dart'; 7 | 8 | void main() => runApp(const MyApp()); 9 | 10 | const _kAssetName = 'assets/sjis-example.txt'; 11 | 12 | class MyApp extends StatelessWidget { 13 | const MyApp({super.key}); 14 | @override 15 | Widget build(BuildContext context) { 16 | return MaterialApp( 17 | home: Scaffold( 18 | appBar: AppBar( 19 | title: const Text('Charset Detector Example'), 20 | ), 21 | body: ListView( 22 | padding: const EdgeInsets.all(8), 23 | children: const [ 24 | _DefaultCharsetCard(_kAssetName), 25 | _DefaultCharsetReplacingCard(_kAssetName), 26 | _DetectedCharsetCard(_kAssetName), 27 | _DetectedOnlyCharsetCard(_kAssetName), 28 | ], 29 | ), 30 | ), 31 | ); 32 | } 33 | } 34 | 35 | class _DefaultCharsetCard extends StatelessWidget { 36 | const _DefaultCharsetCard(this.asset); 37 | final String asset; 38 | @override 39 | Widget build(BuildContext context) { 40 | return _LoadedTextCard( 41 | title: 'Default Charset (UTF-8)', 42 | content: rootBundle.loadString(asset), 43 | ); 44 | } 45 | } 46 | 47 | class _DefaultCharsetReplacingCard extends StatelessWidget { 48 | const _DefaultCharsetReplacingCard(this.asset); 49 | final String asset; 50 | @override 51 | Widget build(BuildContext context) { 52 | return _LoadedTextCard( 53 | title: 'UTF-8 (allow malformed)', 54 | content: _load(), 55 | ); 56 | } 57 | 58 | Future _load() async { 59 | final bytes = await rootBundle.load(asset); 60 | return utf8.decode(bytes.buffer.asUint8List(), allowMalformed: true); 61 | } 62 | } 63 | 64 | class _DetectedCharsetCard extends StatelessWidget { 65 | const _DetectedCharsetCard(this.asset); 66 | final String asset; 67 | @override 68 | Widget build(BuildContext context) { 69 | return FutureBuilder( 70 | future: _load(), 71 | builder: (context, snapshot) { 72 | final charset = snapshot.data?.charset ?? '?'; 73 | return _LoadedTextCard( 74 | title: 'Detected Charset: $charset', 75 | content: snapshot.data?.string, 76 | ); 77 | }, 78 | ); 79 | } 80 | 81 | Future _load() async { 82 | final bytes = await rootBundle.load(asset); 83 | return CharsetDetector.autoDecode(bytes.buffer.asUint8List()); 84 | } 85 | } 86 | 87 | class _DetectedOnlyCharsetCard extends StatelessWidget { 88 | const _DetectedOnlyCharsetCard(this.asset); 89 | final String asset; 90 | @override 91 | Widget build(BuildContext context) { 92 | return FutureBuilder( 93 | future: _load(), 94 | builder: (context, snapshot) { 95 | final charset = snapshot.data ?? '?'; 96 | return _LoadedTextCard( 97 | title: 'Detection only: $charset', 98 | content: null, 99 | ); 100 | }, 101 | ); 102 | } 103 | 104 | Future _load() async { 105 | final bytes = await rootBundle.load(asset); 106 | return CharsetDetector.detect(bytes.buffer.asUint8List()); 107 | } 108 | } 109 | 110 | class _LoadedTextCard extends StatelessWidget { 111 | const _LoadedTextCard({required this.title, required this.content}); 112 | 113 | final String title; 114 | final FutureOr? content; 115 | 116 | @override 117 | Widget build(BuildContext context) { 118 | return _TitleCard( 119 | title: title, 120 | child: FutureBuilder( 121 | future: Future.value(content), 122 | initialData: 'Loading...', 123 | builder: (context, snapshot) => Container( 124 | padding: const EdgeInsets.all(8), 125 | decoration: BoxDecoration( 126 | color: Colors.grey.shade100, 127 | borderRadius: const BorderRadius.all(Radius.circular(2)), 128 | ), 129 | child: Text(snapshot.data?.trim() ?? snapshot.error.toString()), 130 | ), 131 | ), 132 | ); 133 | } 134 | } 135 | 136 | class _TitleCard extends StatelessWidget { 137 | const _TitleCard({required this.title, required this.child}); 138 | 139 | final String title; 140 | final Widget child; 141 | @override 142 | Widget build(BuildContext context) { 143 | return Card( 144 | child: Padding( 145 | padding: const EdgeInsets.all(16), 146 | child: Column( 147 | crossAxisAlignment: CrossAxisAlignment.start, 148 | children: [ 149 | Text( 150 | title, 151 | style: Theme.of(context).textTheme.titleLarge, 152 | ), 153 | const SizedBox(height: 16), 154 | child, 155 | ], 156 | ), 157 | ), 158 | ); 159 | } 160 | } 161 | -------------------------------------------------------------------------------- /flutter_charset_detector/example/macos/.gitignore: -------------------------------------------------------------------------------- 1 | # Flutter-related 2 | **/Flutter/ephemeral/ 3 | **/Pods/ 4 | 5 | # Xcode-related 6 | **/dgph 7 | **/xcuserdata/ 8 | -------------------------------------------------------------------------------- /flutter_charset_detector/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 | -------------------------------------------------------------------------------- /flutter_charset_detector/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 | -------------------------------------------------------------------------------- /flutter_charset_detector/example/macos/Flutter/GeneratedPluginRegistrant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | import FlutterMacOS 6 | import Foundation 7 | 8 | import flutter_charset_detector_darwin 9 | 10 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 11 | FlutterCharsetDetectorPlugin.register(with: registry.registrar(forPlugin: "FlutterCharsetDetectorPlugin")) 12 | } 13 | -------------------------------------------------------------------------------- /flutter_charset_detector/example/macos/Podfile: -------------------------------------------------------------------------------- 1 | platform :osx, '10.14' 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 | target 'RunnerTests' do 35 | inherit! :search_paths 36 | end 37 | end 38 | 39 | post_install do |installer| 40 | installer.pods_project.targets.each do |target| 41 | flutter_additional_macos_build_settings(target) 42 | end 43 | end 44 | -------------------------------------------------------------------------------- /flutter_charset_detector/example/macos/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - flutter_charset_detector_darwin (0.0.1): 3 | - Flutter 4 | - FlutterMacOS 5 | - UniversalDetector2 (= 2.0.1) 6 | - FlutterMacOS (1.0.0) 7 | - UniversalDetector2 (2.0.1) 8 | 9 | DEPENDENCIES: 10 | - flutter_charset_detector_darwin (from `Flutter/ephemeral/.symlinks/plugins/flutter_charset_detector_darwin/darwin`) 11 | - FlutterMacOS (from `Flutter/ephemeral`) 12 | 13 | SPEC REPOS: 14 | trunk: 15 | - UniversalDetector2 16 | 17 | EXTERNAL SOURCES: 18 | flutter_charset_detector_darwin: 19 | :path: Flutter/ephemeral/.symlinks/plugins/flutter_charset_detector_darwin/darwin 20 | FlutterMacOS: 21 | :path: Flutter/ephemeral 22 | 23 | SPEC CHECKSUMS: 24 | flutter_charset_detector_darwin: fb3692d6d72cb6afcce7b0dd1a9516be6e78556e 25 | FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 26 | UniversalDetector2: 7c9ffd935cf050eeb19edf7e90f6febe3743a1af 27 | 28 | PODFILE CHECKSUM: 236401fc2c932af29a9fcf0e97baeeb2d750d367 29 | 30 | COCOAPODS: 1.14.3 31 | -------------------------------------------------------------------------------- /flutter_charset_detector/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /flutter_charset_detector/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 43 | 49 | 50 | 51 | 52 | 53 | 63 | 65 | 71 | 72 | 73 | 74 | 80 | 82 | 88 | 89 | 90 | 91 | 93 | 94 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /flutter_charset_detector/example/macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /flutter_charset_detector/example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /flutter_charset_detector/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 | -------------------------------------------------------------------------------- /flutter_charset_detector/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "16x16", 5 | "idiom" : "mac", 6 | "filename" : "app_icon_16.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "16x16", 11 | "idiom" : "mac", 12 | "filename" : "app_icon_32.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "size" : "32x32", 17 | "idiom" : "mac", 18 | "filename" : "app_icon_32.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "32x32", 23 | "idiom" : "mac", 24 | "filename" : "app_icon_64.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "128x128", 29 | "idiom" : "mac", 30 | "filename" : "app_icon_128.png", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "size" : "128x128", 35 | "idiom" : "mac", 36 | "filename" : "app_icon_256.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "256x256", 41 | "idiom" : "mac", 42 | "filename" : "app_icon_256.png", 43 | "scale" : "1x" 44 | }, 45 | { 46 | "size" : "256x256", 47 | "idiom" : "mac", 48 | "filename" : "app_icon_512.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "512x512", 53 | "idiom" : "mac", 54 | "filename" : "app_icon_512.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "512x512", 59 | "idiom" : "mac", 60 | "filename" : "app_icon_1024.png", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /flutter_charset_detector/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amake/flutter_charset_detector/5d32e065b12bd48765db9122f99e20af8bbab5c1/flutter_charset_detector/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /flutter_charset_detector/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amake/flutter_charset_detector/5d32e065b12bd48765db9122f99e20af8bbab5c1/flutter_charset_detector/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /flutter_charset_detector/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amake/flutter_charset_detector/5d32e065b12bd48765db9122f99e20af8bbab5c1/flutter_charset_detector/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /flutter_charset_detector/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amake/flutter_charset_detector/5d32e065b12bd48765db9122f99e20af8bbab5c1/flutter_charset_detector/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /flutter_charset_detector/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amake/flutter_charset_detector/5d32e065b12bd48765db9122f99e20af8bbab5c1/flutter_charset_detector/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /flutter_charset_detector/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amake/flutter_charset_detector/5d32e065b12bd48765db9122f99e20af8bbab5c1/flutter_charset_detector/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /flutter_charset_detector/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amake/flutter_charset_detector/5d32e065b12bd48765db9122f99e20af8bbab5c1/flutter_charset_detector/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png -------------------------------------------------------------------------------- /flutter_charset_detector/example/macos/Runner/Base.lproj/MainMenu.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | -------------------------------------------------------------------------------- /flutter_charset_detector/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.madlonkay.example 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2024 com.madlonkay. All rights reserved. 15 | -------------------------------------------------------------------------------- /flutter_charset_detector/example/macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /flutter_charset_detector/example/macos/Runner/Configs/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Release.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /flutter_charset_detector/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 | -------------------------------------------------------------------------------- /flutter_charset_detector/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 | -------------------------------------------------------------------------------- /flutter_charset_detector/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 | -------------------------------------------------------------------------------- /flutter_charset_detector/example/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 | -------------------------------------------------------------------------------- /flutter_charset_detector/example/macos/Runner/Release.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /flutter_charset_detector/example/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 | -------------------------------------------------------------------------------- /flutter_charset_detector/example/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | async: 5 | dependency: transitive 6 | description: 7 | name: async 8 | sha256: d2872f9c19731c2e5f10444b14686eb7cc85c76274bd6c16e1816bff9a3bab63 9 | url: "https://pub.dev" 10 | source: hosted 11 | version: "2.12.0" 12 | boolean_selector: 13 | dependency: transitive 14 | description: 15 | name: boolean_selector 16 | sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" 17 | url: "https://pub.dev" 18 | source: hosted 19 | version: "2.1.2" 20 | characters: 21 | dependency: transitive 22 | description: 23 | name: characters 24 | sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 25 | url: "https://pub.dev" 26 | source: hosted 27 | version: "1.4.0" 28 | clock: 29 | dependency: transitive 30 | description: 31 | name: clock 32 | sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b 33 | url: "https://pub.dev" 34 | source: hosted 35 | version: "1.1.2" 36 | collection: 37 | dependency: transitive 38 | description: 39 | name: collection 40 | sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" 41 | url: "https://pub.dev" 42 | source: hosted 43 | version: "1.19.1" 44 | fake_async: 45 | dependency: transitive 46 | description: 47 | name: fake_async 48 | sha256: "6a95e56b2449df2273fd8c45a662d6947ce1ebb7aafe80e550a3f68297f3cacc" 49 | url: "https://pub.dev" 50 | source: hosted 51 | version: "1.3.2" 52 | flutter: 53 | dependency: "direct main" 54 | description: flutter 55 | source: sdk 56 | version: "0.0.0" 57 | flutter_charset_detector: 58 | dependency: "direct main" 59 | description: 60 | path: ".." 61 | relative: true 62 | source: path 63 | version: "5.0.0" 64 | flutter_charset_detector_android: 65 | dependency: transitive 66 | description: 67 | name: flutter_charset_detector_android 68 | sha256: "443145e8fc8515b3b32aee375691e40dd59197a86a2ae153166bc88c8200d83b" 69 | url: "https://pub.dev" 70 | source: hosted 71 | version: "3.0.0" 72 | flutter_charset_detector_darwin: 73 | dependency: transitive 74 | description: 75 | name: flutter_charset_detector_darwin 76 | sha256: daac20390275efb92fbb14350fe11286c5e29c7b80d6b0867f52d760f0d69763 77 | url: "https://pub.dev" 78 | source: hosted 79 | version: "1.1.0" 80 | flutter_charset_detector_platform_interface: 81 | dependency: transitive 82 | description: 83 | name: flutter_charset_detector_platform_interface 84 | sha256: "1c09ed7b314a5a9dde76057b98b7d35458ba881eed03d5e5b6f7f74b4869d18c" 85 | url: "https://pub.dev" 86 | source: hosted 87 | version: "1.1.0" 88 | flutter_charset_detector_web: 89 | dependency: transitive 90 | description: 91 | name: flutter_charset_detector_web 92 | sha256: e3ac65f94b12f4887937b21a19365d7927db816840cb93274e3861241cb0e9f2 93 | url: "https://pub.dev" 94 | source: hosted 95 | version: "2.0.0" 96 | flutter_lints: 97 | dependency: "direct dev" 98 | description: 99 | name: flutter_lints 100 | sha256: "3f41d009ba7172d5ff9be5f6e6e6abb4300e263aab8866d2a0842ed2a70f8f0c" 101 | url: "https://pub.dev" 102 | source: hosted 103 | version: "4.0.0" 104 | flutter_test: 105 | dependency: "direct dev" 106 | description: flutter 107 | source: sdk 108 | version: "0.0.0" 109 | flutter_web_plugins: 110 | dependency: transitive 111 | description: flutter 112 | source: sdk 113 | version: "0.0.0" 114 | leak_tracker: 115 | dependency: transitive 116 | description: 117 | name: leak_tracker 118 | sha256: c35baad643ba394b40aac41080300150a4f08fd0fd6a10378f8f7c6bc161acec 119 | url: "https://pub.dev" 120 | source: hosted 121 | version: "10.0.8" 122 | leak_tracker_flutter_testing: 123 | dependency: transitive 124 | description: 125 | name: leak_tracker_flutter_testing 126 | sha256: f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573 127 | url: "https://pub.dev" 128 | source: hosted 129 | version: "3.0.9" 130 | leak_tracker_testing: 131 | dependency: transitive 132 | description: 133 | name: leak_tracker_testing 134 | sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" 135 | url: "https://pub.dev" 136 | source: hosted 137 | version: "3.0.1" 138 | lints: 139 | dependency: transitive 140 | description: 141 | name: lints 142 | sha256: "976c774dd944a42e83e2467f4cc670daef7eed6295b10b36ae8c85bcbf828235" 143 | url: "https://pub.dev" 144 | source: hosted 145 | version: "4.0.0" 146 | matcher: 147 | dependency: transitive 148 | description: 149 | name: matcher 150 | sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 151 | url: "https://pub.dev" 152 | source: hosted 153 | version: "0.12.17" 154 | material_color_utilities: 155 | dependency: transitive 156 | description: 157 | name: material_color_utilities 158 | sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec 159 | url: "https://pub.dev" 160 | source: hosted 161 | version: "0.11.1" 162 | meta: 163 | dependency: transitive 164 | description: 165 | name: meta 166 | sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c 167 | url: "https://pub.dev" 168 | source: hosted 169 | version: "1.16.0" 170 | path: 171 | dependency: transitive 172 | description: 173 | name: path 174 | sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" 175 | url: "https://pub.dev" 176 | source: hosted 177 | version: "1.9.1" 178 | plugin_platform_interface: 179 | dependency: transitive 180 | description: 181 | name: plugin_platform_interface 182 | sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" 183 | url: "https://pub.dev" 184 | source: hosted 185 | version: "2.1.8" 186 | sky_engine: 187 | dependency: transitive 188 | description: flutter 189 | source: sdk 190 | version: "0.0.0" 191 | source_span: 192 | dependency: transitive 193 | description: 194 | name: source_span 195 | sha256: "254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c" 196 | url: "https://pub.dev" 197 | source: hosted 198 | version: "1.10.1" 199 | stack_trace: 200 | dependency: transitive 201 | description: 202 | name: stack_trace 203 | sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" 204 | url: "https://pub.dev" 205 | source: hosted 206 | version: "1.12.1" 207 | stream_channel: 208 | dependency: transitive 209 | description: 210 | name: stream_channel 211 | sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" 212 | url: "https://pub.dev" 213 | source: hosted 214 | version: "2.1.4" 215 | string_scanner: 216 | dependency: transitive 217 | description: 218 | name: string_scanner 219 | sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" 220 | url: "https://pub.dev" 221 | source: hosted 222 | version: "1.4.1" 223 | term_glyph: 224 | dependency: transitive 225 | description: 226 | name: term_glyph 227 | sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" 228 | url: "https://pub.dev" 229 | source: hosted 230 | version: "1.2.2" 231 | test_api: 232 | dependency: transitive 233 | description: 234 | name: test_api 235 | sha256: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd 236 | url: "https://pub.dev" 237 | source: hosted 238 | version: "0.7.4" 239 | vector_math: 240 | dependency: transitive 241 | description: 242 | name: vector_math 243 | sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" 244 | url: "https://pub.dev" 245 | source: hosted 246 | version: "2.1.4" 247 | vm_service: 248 | dependency: transitive 249 | description: 250 | name: vm_service 251 | sha256: "0968250880a6c5fe7edc067ed0a13d4bae1577fe2771dcf3010d52c4a9d3ca14" 252 | url: "https://pub.dev" 253 | source: hosted 254 | version: "14.3.1" 255 | sdks: 256 | dart: ">=3.7.0-0 <4.0.0" 257 | flutter: ">=3.18.0-18.0.pre.54" 258 | -------------------------------------------------------------------------------- /flutter_charset_detector/example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_charset_detector_example 2 | description: Demonstrates how to use the flutter_charset_detector plugin. 3 | 4 | publish_to: 'none' 5 | 6 | environment: 7 | sdk: '>=3.0.0 <4.0.0' 8 | 9 | dependencies: 10 | flutter: 11 | sdk: flutter 12 | 13 | flutter_charset_detector: 14 | path: ../ 15 | 16 | dev_dependencies: 17 | flutter_lints: ^4.0.0 18 | flutter_test: 19 | sdk: flutter 20 | 21 | flutter: 22 | uses-material-design: true 23 | assets: 24 | - assets/sjis-example.txt 25 | -------------------------------------------------------------------------------- /flutter_charset_detector/example/test/widget_test.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter_charset_detector_example/main.dart'; 5 | import 'package:flutter_test/flutter_test.dart'; 6 | 7 | void main() { 8 | testWidgets('Launch app', (tester) async { 9 | await runZonedGuarded(() async { 10 | await tester.pumpWidget(const MyApp()); 11 | expect( 12 | find.byWidgetPredicate((widget) => 13 | widget is Text && widget.data!.startsWith('Default Charset')), 14 | findsOneWidget, 15 | ); 16 | }, (error, stack) { 17 | expectSync(error, isA()); 18 | }); 19 | }); 20 | } 21 | -------------------------------------------------------------------------------- /flutter_charset_detector/example/web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amake/flutter_charset_detector/5d32e065b12bd48765db9122f99e20af8bbab5c1/flutter_charset_detector/example/web/favicon.png -------------------------------------------------------------------------------- /flutter_charset_detector/example/web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amake/flutter_charset_detector/5d32e065b12bd48765db9122f99e20af8bbab5c1/flutter_charset_detector/example/web/icons/Icon-192.png -------------------------------------------------------------------------------- /flutter_charset_detector/example/web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amake/flutter_charset_detector/5d32e065b12bd48765db9122f99e20af8bbab5c1/flutter_charset_detector/example/web/icons/Icon-512.png -------------------------------------------------------------------------------- /flutter_charset_detector/example/web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amake/flutter_charset_detector/5d32e065b12bd48765db9122f99e20af8bbab5c1/flutter_charset_detector/example/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /flutter_charset_detector/example/web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amake/flutter_charset_detector/5d32e065b12bd48765db9122f99e20af8bbab5c1/flutter_charset_detector/example/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /flutter_charset_detector/example/web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | example 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /flutter_charset_detector/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 | -------------------------------------------------------------------------------- /flutter_charset_detector/lib/flutter_charset_detector.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:typed_data'; 3 | 4 | import 'package:flutter_charset_detector_platform_interface/decoding_result.dart'; 5 | import 'package:flutter_charset_detector_platform_interface/flutter_charset_detector_platform_interface.dart'; 6 | 7 | export 'package:flutter_charset_detector_platform_interface/decoding_result.dart'; 8 | 9 | CharsetDetectorPlatform get _platform => CharsetDetectorPlatform.instance; 10 | 11 | // Legacy wrapper class for backwards compatibility 12 | class CharsetDetector { 13 | /// Automatically detect the charset of [bytes] and decode to a string. 14 | static Future autoDecode(Uint8List bytes) => 15 | _platform.autoDecode(bytes); 16 | 17 | /// Detect and return the charset of [bytes]. 18 | static Future detect(Uint8List bytes) => _platform.detect(bytes); 19 | } 20 | -------------------------------------------------------------------------------- /flutter_charset_detector/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | async: 5 | dependency: transitive 6 | description: 7 | name: async 8 | sha256: d2872f9c19731c2e5f10444b14686eb7cc85c76274bd6c16e1816bff9a3bab63 9 | url: "https://pub.dev" 10 | source: hosted 11 | version: "2.12.0" 12 | boolean_selector: 13 | dependency: transitive 14 | description: 15 | name: boolean_selector 16 | sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" 17 | url: "https://pub.dev" 18 | source: hosted 19 | version: "2.1.2" 20 | characters: 21 | dependency: transitive 22 | description: 23 | name: characters 24 | sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 25 | url: "https://pub.dev" 26 | source: hosted 27 | version: "1.4.0" 28 | clock: 29 | dependency: transitive 30 | description: 31 | name: clock 32 | sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b 33 | url: "https://pub.dev" 34 | source: hosted 35 | version: "1.1.2" 36 | collection: 37 | dependency: transitive 38 | description: 39 | name: collection 40 | sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" 41 | url: "https://pub.dev" 42 | source: hosted 43 | version: "1.19.1" 44 | fake_async: 45 | dependency: transitive 46 | description: 47 | name: fake_async 48 | sha256: "6a95e56b2449df2273fd8c45a662d6947ce1ebb7aafe80e550a3f68297f3cacc" 49 | url: "https://pub.dev" 50 | source: hosted 51 | version: "1.3.2" 52 | flutter: 53 | dependency: "direct main" 54 | description: flutter 55 | source: sdk 56 | version: "0.0.0" 57 | flutter_charset_detector_android: 58 | dependency: "direct main" 59 | description: 60 | name: flutter_charset_detector_android 61 | sha256: "443145e8fc8515b3b32aee375691e40dd59197a86a2ae153166bc88c8200d83b" 62 | url: "https://pub.dev" 63 | source: hosted 64 | version: "3.0.0" 65 | flutter_charset_detector_darwin: 66 | dependency: "direct main" 67 | description: 68 | name: flutter_charset_detector_darwin 69 | sha256: daac20390275efb92fbb14350fe11286c5e29c7b80d6b0867f52d760f0d69763 70 | url: "https://pub.dev" 71 | source: hosted 72 | version: "1.1.0" 73 | flutter_charset_detector_platform_interface: 74 | dependency: "direct main" 75 | description: 76 | name: flutter_charset_detector_platform_interface 77 | sha256: "1c09ed7b314a5a9dde76057b98b7d35458ba881eed03d5e5b6f7f74b4869d18c" 78 | url: "https://pub.dev" 79 | source: hosted 80 | version: "1.1.0" 81 | flutter_charset_detector_web: 82 | dependency: "direct main" 83 | description: 84 | name: flutter_charset_detector_web 85 | sha256: e3ac65f94b12f4887937b21a19365d7927db816840cb93274e3861241cb0e9f2 86 | url: "https://pub.dev" 87 | source: hosted 88 | version: "2.0.0" 89 | flutter_lints: 90 | dependency: "direct dev" 91 | description: 92 | name: flutter_lints 93 | sha256: "5398f14efa795ffb7a33e9b6a08798b26a180edac4ad7db3f231e40f82ce11e1" 94 | url: "https://pub.dev" 95 | source: hosted 96 | version: "5.0.0" 97 | flutter_test: 98 | dependency: "direct dev" 99 | description: flutter 100 | source: sdk 101 | version: "0.0.0" 102 | flutter_web_plugins: 103 | dependency: transitive 104 | description: flutter 105 | source: sdk 106 | version: "0.0.0" 107 | leak_tracker: 108 | dependency: transitive 109 | description: 110 | name: leak_tracker 111 | sha256: c35baad643ba394b40aac41080300150a4f08fd0fd6a10378f8f7c6bc161acec 112 | url: "https://pub.dev" 113 | source: hosted 114 | version: "10.0.8" 115 | leak_tracker_flutter_testing: 116 | dependency: transitive 117 | description: 118 | name: leak_tracker_flutter_testing 119 | sha256: f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573 120 | url: "https://pub.dev" 121 | source: hosted 122 | version: "3.0.9" 123 | leak_tracker_testing: 124 | dependency: transitive 125 | description: 126 | name: leak_tracker_testing 127 | sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" 128 | url: "https://pub.dev" 129 | source: hosted 130 | version: "3.0.1" 131 | lints: 132 | dependency: transitive 133 | description: 134 | name: lints 135 | sha256: c35bb79562d980e9a453fc715854e1ed39e24e7d0297a880ef54e17f9874a9d7 136 | url: "https://pub.dev" 137 | source: hosted 138 | version: "5.1.1" 139 | matcher: 140 | dependency: transitive 141 | description: 142 | name: matcher 143 | sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 144 | url: "https://pub.dev" 145 | source: hosted 146 | version: "0.12.17" 147 | material_color_utilities: 148 | dependency: transitive 149 | description: 150 | name: material_color_utilities 151 | sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec 152 | url: "https://pub.dev" 153 | source: hosted 154 | version: "0.11.1" 155 | meta: 156 | dependency: transitive 157 | description: 158 | name: meta 159 | sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c 160 | url: "https://pub.dev" 161 | source: hosted 162 | version: "1.16.0" 163 | path: 164 | dependency: transitive 165 | description: 166 | name: path 167 | sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" 168 | url: "https://pub.dev" 169 | source: hosted 170 | version: "1.9.1" 171 | plugin_platform_interface: 172 | dependency: "direct dev" 173 | description: 174 | name: plugin_platform_interface 175 | sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" 176 | url: "https://pub.dev" 177 | source: hosted 178 | version: "2.1.8" 179 | sky_engine: 180 | dependency: transitive 181 | description: flutter 182 | source: sdk 183 | version: "0.0.0" 184 | source_span: 185 | dependency: transitive 186 | description: 187 | name: source_span 188 | sha256: "254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c" 189 | url: "https://pub.dev" 190 | source: hosted 191 | version: "1.10.1" 192 | stack_trace: 193 | dependency: transitive 194 | description: 195 | name: stack_trace 196 | sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" 197 | url: "https://pub.dev" 198 | source: hosted 199 | version: "1.12.1" 200 | stream_channel: 201 | dependency: transitive 202 | description: 203 | name: stream_channel 204 | sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" 205 | url: "https://pub.dev" 206 | source: hosted 207 | version: "2.1.4" 208 | string_scanner: 209 | dependency: transitive 210 | description: 211 | name: string_scanner 212 | sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" 213 | url: "https://pub.dev" 214 | source: hosted 215 | version: "1.4.1" 216 | term_glyph: 217 | dependency: transitive 218 | description: 219 | name: term_glyph 220 | sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" 221 | url: "https://pub.dev" 222 | source: hosted 223 | version: "1.2.2" 224 | test_api: 225 | dependency: transitive 226 | description: 227 | name: test_api 228 | sha256: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd 229 | url: "https://pub.dev" 230 | source: hosted 231 | version: "0.7.4" 232 | vector_math: 233 | dependency: transitive 234 | description: 235 | name: vector_math 236 | sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" 237 | url: "https://pub.dev" 238 | source: hosted 239 | version: "2.1.4" 240 | vm_service: 241 | dependency: transitive 242 | description: 243 | name: vm_service 244 | sha256: "0968250880a6c5fe7edc067ed0a13d4bae1577fe2771dcf3010d52c4a9d3ca14" 245 | url: "https://pub.dev" 246 | source: hosted 247 | version: "14.3.1" 248 | sdks: 249 | dart: ">=3.7.0-0 <4.0.0" 250 | flutter: ">=3.18.0-18.0.pre.54" 251 | -------------------------------------------------------------------------------- /flutter_charset_detector/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_charset_detector 2 | description: Detect and decode the charset (character encoding) of text bytes 3 | version: 5.0.0 4 | homepage: https://github.com/amake/flutter_charset_detector 5 | 6 | environment: 7 | sdk: '>=2.12.0 <4.0.0' 8 | flutter: '>=1.20.0' 9 | 10 | dependencies: 11 | flutter: 12 | sdk: flutter 13 | flutter_charset_detector_android: ^3.0.0 14 | # flutter_charset_detector_android: 15 | # path: ../flutter_charset_detector_android 16 | flutter_charset_detector_darwin: ^1.1.0 17 | # flutter_charset_detector_darwin: 18 | # path: ../flutter_charset_detector_darwin 19 | flutter_charset_detector_web: ^2.0.0 20 | # flutter_charset_detector_web: 21 | # path: ../flutter_charset_detector_web 22 | flutter_charset_detector_platform_interface: ^1.1.0 23 | # flutter_charset_detector_platform_interface: 24 | # path: ../flutter_charset_detector_platform_interface 25 | 26 | dev_dependencies: 27 | flutter_lints: ^5.0.0 28 | flutter_test: 29 | sdk: flutter 30 | plugin_platform_interface: ^2.0.1 31 | 32 | flutter: 33 | plugin: 34 | platforms: 35 | android: 36 | default_package: flutter_charset_detector_android 37 | ios: 38 | default_package: flutter_charset_detector_darwin 39 | macos: 40 | default_package: flutter_charset_detector_darwin 41 | web: 42 | default_package: flutter_charset_detector_web 43 | 44 | topics: 45 | - text 46 | - encoding 47 | - charset 48 | - detection 49 | - flutter 50 | -------------------------------------------------------------------------------- /flutter_charset_detector/test/flutter_charset_detector_test.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:flutter/services.dart'; 4 | import 'package:flutter_charset_detector/flutter_charset_detector.dart'; 5 | import 'package:flutter_test/flutter_test.dart'; 6 | 7 | void main() { 8 | const channel = MethodChannel('flutter_charset_detector'); 9 | 10 | TestWidgetsFlutterBinding.ensureInitialized(); 11 | 12 | setUp(() { 13 | TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger 14 | .setMockMethodCallHandler(channel, (methodCall) async { 15 | switch (methodCall.method) { 16 | case 'autoDecode': 17 | final args = methodCall.arguments as Map; 18 | return { 19 | 'string': utf8.decode(args['data'] as Uint8List), 20 | 'charset': utf8.name, 21 | }; 22 | case 'detect': 23 | return 'utf-8'; 24 | default: 25 | throw PlatformException(code: 'foo'); 26 | } 27 | }); 28 | }); 29 | 30 | tearDown(() { 31 | TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger 32 | .setMockMethodCallHandler(channel, null); 33 | }); 34 | 35 | test('testAutoDecode', () async { 36 | const string = 'blah'; 37 | final bytes = Uint8List.fromList(utf8.encode(string)); 38 | final result = await CharsetDetector.autoDecode(bytes); 39 | expect(result.charset, 'utf-8'); 40 | expect(result.string, string); 41 | }); 42 | test('testDetect', () async { 43 | const string = 'blah'; 44 | final bytes = Uint8List.fromList(utf8.encode(string)); 45 | final result = await CharsetDetector.detect(bytes); 46 | expect(result, 'utf-8'); 47 | }); 48 | } 49 | -------------------------------------------------------------------------------- /flutter_charset_detector_android/.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: 81a45ec2e5f80fa71d5135f1702ce540558b416d 8 | channel: beta 9 | 10 | project_type: plugin 11 | -------------------------------------------------------------------------------- /flutter_charset_detector_android/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 3.0.0 2 | * Bump juniversalchardet to 2.5.0 3 | * Bump Kotlin to 1.7.10 4 | * Bump compileSdk to 34 5 | * Bump minSdk to 21 6 | 7 | ## 2.1.1 8 | * Fix errors 9 | 10 | ## 2.1.0 11 | * Add `detect` method to obtain the detected charset without decoding the 12 | supplied bytes 13 | 14 | ## 2.0.1 15 | * Fix type cast error introduced in 2.0.0 16 | 17 | ## 2.0.0 18 | * Move to Android Gradle Plugin 8 19 | 20 | ## 1.0.0 21 | 22 | * Initial release 23 | -------------------------------------------------------------------------------- /flutter_charset_detector_android/README.md: -------------------------------------------------------------------------------- 1 | # flutter\_charset\_detector\_android 2 | 3 | The Android implementation of [`flutter_charset_detector`][1]. 4 | 5 | ## Usage 6 | 7 | This package is [endorsed][2], which means you can simply use 8 | `flutter_charset_detector` normally. This package will be automatically included 9 | in your app when you do. 10 | 11 | [1]: https://pub.dev/packages/flutter_charset_detector 12 | [2]: https://flutter.dev/docs/development/packages-and-plugins/developing-packages#endorsed-federated-plugin 13 | -------------------------------------------------------------------------------- /flutter_charset_detector_android/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:flutter_lints/flutter.yaml 2 | 3 | analyzer: 4 | language: 5 | strict-casts: true 6 | strict-inference: true 7 | strict-raw-types: true 8 | -------------------------------------------------------------------------------- /flutter_charset_detector_android/android/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | -------------------------------------------------------------------------------- /flutter_charset_detector_android/android/build.gradle: -------------------------------------------------------------------------------- 1 | group 'com.madlonkay.flutter_charset_detector' 2 | version '1.0-SNAPSHOT' 3 | 4 | buildscript { 5 | ext.kotlin_version = '1.7.10' 6 | repositories { 7 | google() 8 | mavenCentral() 9 | } 10 | 11 | dependencies { 12 | classpath 'com.android.tools.build:gradle:8.1.1' 13 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 14 | } 15 | } 16 | 17 | allprojects { 18 | repositories { 19 | google() 20 | mavenCentral() 21 | } 22 | } 23 | 24 | apply plugin: 'com.android.library' 25 | apply plugin: 'kotlin-android' 26 | 27 | android { 28 | namespace 'com.madlonkay.flutter_charset_detector' 29 | 30 | compileSdk = 34 31 | 32 | compileOptions { 33 | sourceCompatibility = JavaVersion.VERSION_1_8 34 | targetCompatibility = JavaVersion.VERSION_1_8 35 | } 36 | 37 | kotlinOptions { 38 | jvmTarget = '1.8' 39 | } 40 | 41 | sourceSets { 42 | main.java.srcDirs += 'src/main/kotlin' 43 | } 44 | 45 | defaultConfig { 46 | minSdk = 21 47 | } 48 | } 49 | 50 | dependencies { 51 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 52 | implementation 'com.github.albfernandez:juniversalchardet:2.5.0' 53 | } 54 | -------------------------------------------------------------------------------- /flutter_charset_detector_android/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | android.defaults.buildfeatures.buildconfig=true 5 | android.nonTransitiveRClass=false 6 | android.nonFinalResIds=false 7 | -------------------------------------------------------------------------------- /flutter_charset_detector_android/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Sep 22 00:09:07 JST 2023 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip 5 | zipStoreBase=GRADLE_USER_HOME 6 | zipStorePath=wrapper/dists 7 | -------------------------------------------------------------------------------- /flutter_charset_detector_android/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'flutter_charset_detector' 2 | -------------------------------------------------------------------------------- /flutter_charset_detector_android/android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /flutter_charset_detector_android/android/src/main/kotlin/com/madlonkay/flutter_charset_detector/FlutterCharsetDetectorPlugin.kt: -------------------------------------------------------------------------------- 1 | package com.madlonkay.flutter_charset_detector 2 | 3 | import androidx.annotation.NonNull 4 | import io.flutter.embedding.engine.plugins.FlutterPlugin 5 | import io.flutter.plugin.common.MethodCall 6 | import io.flutter.plugin.common.MethodChannel 7 | import io.flutter.plugin.common.MethodChannel.MethodCallHandler 8 | import io.flutter.plugin.common.MethodChannel.Result 9 | import org.mozilla.universalchardet.UniversalDetector 10 | import java.nio.ByteBuffer 11 | import java.nio.charset.Charset 12 | import java.nio.charset.IllegalCharsetNameException 13 | import java.nio.charset.UnsupportedCharsetException 14 | 15 | /** FlutterCharsetDetectorPlugin */ 16 | class FlutterCharsetDetectorPlugin : FlutterPlugin, MethodCallHandler { 17 | private lateinit var channel: MethodChannel 18 | 19 | override fun onAttachedToEngine(@NonNull flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) { 20 | channel = MethodChannel(flutterPluginBinding.binaryMessenger, "flutter_charset_detector") 21 | channel.setMethodCallHandler(this) 22 | } 23 | 24 | override fun onMethodCall(@NonNull call: MethodCall, @NonNull result: Result) { 25 | when (call.method) { 26 | "autoDecode" -> handleAutoDecode(call, result) 27 | "detect" -> handleDetect(call, result) 28 | else -> result.notImplemented() 29 | } 30 | } 31 | 32 | private fun handleAutoDecode(call: MethodCall, result: Result) { 33 | val data = call.argument("data") 34 | if (data == null) { 35 | result.error("MissingArg", "Required argument missing", "${call.method} requires 'data'") 36 | return 37 | } 38 | val charsetName = data.inputStream().use(UniversalDetector::detectCharset) 39 | if (charsetName == null) { 40 | result.error("DetectionFailed", "The charset could not be detected", null) 41 | return 42 | } 43 | val charset: Charset = try { 44 | Charset.forName(charsetName) 45 | } catch (e: Exception) { 46 | when (e) { 47 | is IllegalCharsetNameException, 48 | is UnsupportedCharsetException -> { 49 | result.error("UnsupportedCharset", "The detected charset $charsetName is not supported.", null) 50 | return 51 | } 52 | else -> throw e 53 | } 54 | } 55 | val string = charset.decode(ByteBuffer.wrap(data)).toString() 56 | result.success( 57 | mapOf( 58 | "charset" to charsetName, 59 | "string" to string 60 | ) 61 | ) 62 | } 63 | 64 | private fun handleDetect(call: MethodCall, result: Result) { 65 | val data = call.argument("data") 66 | if (data == null) { 67 | result.error("MissingArg", "Required argument missing", "${call.method} requires 'data'") 68 | return 69 | } 70 | val charsetName = data.inputStream().use(UniversalDetector::detectCharset) 71 | if (charsetName == null) { 72 | result.error("DetectionFailed", "The charset could not be detected", null) 73 | return 74 | } 75 | result.success(charsetName) 76 | } 77 | 78 | override fun onDetachedFromEngine(@NonNull binding: FlutterPlugin.FlutterPluginBinding) { 79 | channel.setMethodCallHandler(null) 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /flutter_charset_detector_android/lib/flutter_charset_detector_android.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/services.dart'; 2 | import 'package:flutter_charset_detector_platform_interface/decoding_result.dart'; 3 | import 'package:flutter_charset_detector_platform_interface/flutter_charset_detector_platform_interface.dart'; 4 | 5 | class CharsetDetectorAndroid extends CharsetDetectorPlatform { 6 | /// The method channel used to interact with the native platform. 7 | static const MethodChannel _channel = 8 | MethodChannel('flutter_charset_detector'); 9 | 10 | /// Registers this class as the default instance of [CharsetDetectorPlatform] 11 | static void registerWith() => 12 | CharsetDetectorPlatform.instance = CharsetDetectorAndroid(); 13 | 14 | /// Automatically detect the charset of [bytes] and decode to a string. 15 | @override 16 | Future autoDecode(Uint8List bytes) async { 17 | final result = await _channel 18 | .invokeMethod>('autoDecode', {'data': bytes}); 19 | return DecodingResult.fromJson(result!.cast()); 20 | } 21 | 22 | /// Detect and return the charset of [bytes]. 23 | @override 24 | Future detect(Uint8List bytes) async { 25 | return (await _channel.invokeMethod('detect', {'data': bytes}))!; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /flutter_charset_detector_android/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | async: 5 | dependency: transitive 6 | description: 7 | name: async 8 | sha256: d2872f9c19731c2e5f10444b14686eb7cc85c76274bd6c16e1816bff9a3bab63 9 | url: "https://pub.dev" 10 | source: hosted 11 | version: "2.12.0" 12 | boolean_selector: 13 | dependency: transitive 14 | description: 15 | name: boolean_selector 16 | sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" 17 | url: "https://pub.dev" 18 | source: hosted 19 | version: "2.1.2" 20 | characters: 21 | dependency: transitive 22 | description: 23 | name: characters 24 | sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 25 | url: "https://pub.dev" 26 | source: hosted 27 | version: "1.4.0" 28 | clock: 29 | dependency: transitive 30 | description: 31 | name: clock 32 | sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b 33 | url: "https://pub.dev" 34 | source: hosted 35 | version: "1.1.2" 36 | collection: 37 | dependency: transitive 38 | description: 39 | name: collection 40 | sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" 41 | url: "https://pub.dev" 42 | source: hosted 43 | version: "1.19.1" 44 | fake_async: 45 | dependency: transitive 46 | description: 47 | name: fake_async 48 | sha256: "6a95e56b2449df2273fd8c45a662d6947ce1ebb7aafe80e550a3f68297f3cacc" 49 | url: "https://pub.dev" 50 | source: hosted 51 | version: "1.3.2" 52 | flutter: 53 | dependency: "direct main" 54 | description: flutter 55 | source: sdk 56 | version: "0.0.0" 57 | flutter_charset_detector_platform_interface: 58 | dependency: "direct main" 59 | description: 60 | name: flutter_charset_detector_platform_interface 61 | sha256: "1c09ed7b314a5a9dde76057b98b7d35458ba881eed03d5e5b6f7f74b4869d18c" 62 | url: "https://pub.dev" 63 | source: hosted 64 | version: "1.1.0" 65 | flutter_lints: 66 | dependency: "direct dev" 67 | description: 68 | name: flutter_lints 69 | sha256: "5398f14efa795ffb7a33e9b6a08798b26a180edac4ad7db3f231e40f82ce11e1" 70 | url: "https://pub.dev" 71 | source: hosted 72 | version: "5.0.0" 73 | flutter_test: 74 | dependency: "direct dev" 75 | description: flutter 76 | source: sdk 77 | version: "0.0.0" 78 | leak_tracker: 79 | dependency: transitive 80 | description: 81 | name: leak_tracker 82 | sha256: c35baad643ba394b40aac41080300150a4f08fd0fd6a10378f8f7c6bc161acec 83 | url: "https://pub.dev" 84 | source: hosted 85 | version: "10.0.8" 86 | leak_tracker_flutter_testing: 87 | dependency: transitive 88 | description: 89 | name: leak_tracker_flutter_testing 90 | sha256: f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573 91 | url: "https://pub.dev" 92 | source: hosted 93 | version: "3.0.9" 94 | leak_tracker_testing: 95 | dependency: transitive 96 | description: 97 | name: leak_tracker_testing 98 | sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" 99 | url: "https://pub.dev" 100 | source: hosted 101 | version: "3.0.1" 102 | lints: 103 | dependency: transitive 104 | description: 105 | name: lints 106 | sha256: c35bb79562d980e9a453fc715854e1ed39e24e7d0297a880ef54e17f9874a9d7 107 | url: "https://pub.dev" 108 | source: hosted 109 | version: "5.1.1" 110 | matcher: 111 | dependency: transitive 112 | description: 113 | name: matcher 114 | sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 115 | url: "https://pub.dev" 116 | source: hosted 117 | version: "0.12.17" 118 | material_color_utilities: 119 | dependency: transitive 120 | description: 121 | name: material_color_utilities 122 | sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec 123 | url: "https://pub.dev" 124 | source: hosted 125 | version: "0.11.1" 126 | meta: 127 | dependency: transitive 128 | description: 129 | name: meta 130 | sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c 131 | url: "https://pub.dev" 132 | source: hosted 133 | version: "1.16.0" 134 | path: 135 | dependency: transitive 136 | description: 137 | name: path 138 | sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" 139 | url: "https://pub.dev" 140 | source: hosted 141 | version: "1.9.1" 142 | plugin_platform_interface: 143 | dependency: transitive 144 | description: 145 | name: plugin_platform_interface 146 | sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" 147 | url: "https://pub.dev" 148 | source: hosted 149 | version: "2.1.8" 150 | sky_engine: 151 | dependency: transitive 152 | description: flutter 153 | source: sdk 154 | version: "0.0.0" 155 | source_span: 156 | dependency: transitive 157 | description: 158 | name: source_span 159 | sha256: "254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c" 160 | url: "https://pub.dev" 161 | source: hosted 162 | version: "1.10.1" 163 | stack_trace: 164 | dependency: transitive 165 | description: 166 | name: stack_trace 167 | sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" 168 | url: "https://pub.dev" 169 | source: hosted 170 | version: "1.12.1" 171 | stream_channel: 172 | dependency: transitive 173 | description: 174 | name: stream_channel 175 | sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" 176 | url: "https://pub.dev" 177 | source: hosted 178 | version: "2.1.4" 179 | string_scanner: 180 | dependency: transitive 181 | description: 182 | name: string_scanner 183 | sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" 184 | url: "https://pub.dev" 185 | source: hosted 186 | version: "1.4.1" 187 | term_glyph: 188 | dependency: transitive 189 | description: 190 | name: term_glyph 191 | sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" 192 | url: "https://pub.dev" 193 | source: hosted 194 | version: "1.2.2" 195 | test_api: 196 | dependency: transitive 197 | description: 198 | name: test_api 199 | sha256: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd 200 | url: "https://pub.dev" 201 | source: hosted 202 | version: "0.7.4" 203 | vector_math: 204 | dependency: transitive 205 | description: 206 | name: vector_math 207 | sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" 208 | url: "https://pub.dev" 209 | source: hosted 210 | version: "2.1.4" 211 | vm_service: 212 | dependency: transitive 213 | description: 214 | name: vm_service 215 | sha256: "0968250880a6c5fe7edc067ed0a13d4bae1577fe2771dcf3010d52c4a9d3ca14" 216 | url: "https://pub.dev" 217 | source: hosted 218 | version: "14.3.1" 219 | sdks: 220 | dart: ">=3.7.0-0 <4.0.0" 221 | flutter: ">=3.18.0-18.0.pre.54" 222 | -------------------------------------------------------------------------------- /flutter_charset_detector_android/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_charset_detector_android 2 | description: Android implementation of the flutter_charset_detector plugin. 3 | version: 3.0.0 4 | homepage: https://github.com/amake/flutter_charset_detector 5 | 6 | environment: 7 | sdk: '>=2.12.0 <4.0.0' 8 | flutter: '>=1.20.0' 9 | 10 | dependencies: 11 | flutter: 12 | sdk: flutter 13 | flutter_charset_detector_platform_interface: ^1.1.0 14 | # flutter_charset_detector_platform_interface: 15 | # path: ../flutter_charset_detector_platform_interface 16 | 17 | dev_dependencies: 18 | flutter_lints: ^5.0.0 19 | flutter_test: 20 | sdk: flutter 21 | 22 | flutter: 23 | plugin: 24 | implements: flutter_charset_detector 25 | platforms: 26 | android: 27 | package: com.madlonkay.flutter_charset_detector 28 | pluginClass: FlutterCharsetDetectorPlugin 29 | dartPluginClass: CharsetDetectorAndroid 30 | -------------------------------------------------------------------------------- /flutter_charset_detector_darwin/.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: 81a45ec2e5f80fa71d5135f1702ce540558b416d 8 | channel: beta 9 | 10 | project_type: plugin 11 | -------------------------------------------------------------------------------- /flutter_charset_detector_darwin/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 1.1.0 2 | 3 | * Add `detect` method to obtain the detected charset without decoding the 4 | supplied bytes 5 | 6 | ## 1.0.0 7 | 8 | * Initial release 9 | -------------------------------------------------------------------------------- /flutter_charset_detector_darwin/README.md: -------------------------------------------------------------------------------- 1 | # flutter\_charset\_detector\_darwin 2 | 3 | The Darwin (iOS+macOS) implementation of [`flutter_charset_detector`][1]. 4 | 5 | ## Usage 6 | 7 | This package is [endorsed][2], which means you can simply use 8 | `flutter_charset_detector` normally. This package will be automatically included 9 | in your app when you do. 10 | 11 | [1]: https://pub.dev/packages/flutter_charset_detector 12 | [2]: https://flutter.dev/docs/development/packages-and-plugins/developing-packages#endorsed-federated-plugin 13 | -------------------------------------------------------------------------------- /flutter_charset_detector_darwin/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:flutter_lints/flutter.yaml 2 | 3 | analyzer: 4 | language: 5 | strict-casts: true 6 | strict-inference: true 7 | strict-raw-types: true 8 | -------------------------------------------------------------------------------- /flutter_charset_detector_darwin/darwin/.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | .vagrant/ 3 | .sconsign.dblite 4 | .svn/ 5 | 6 | .DS_Store 7 | *.swp 8 | profile 9 | 10 | DerivedData/ 11 | build/ 12 | GeneratedPluginRegistrant.h 13 | GeneratedPluginRegistrant.m 14 | 15 | .generated/ 16 | 17 | *.pbxuser 18 | *.mode1v3 19 | *.mode2v3 20 | *.perspectivev3 21 | 22 | !default.pbxuser 23 | !default.mode1v3 24 | !default.mode2v3 25 | !default.perspectivev3 26 | 27 | xcuserdata 28 | 29 | *.moved-aside 30 | 31 | *.pyc 32 | *sync/ 33 | Icon? 34 | .tags* 35 | 36 | /Flutter/Generated.xcconfig 37 | /Flutter/flutter_export_environment.sh -------------------------------------------------------------------------------- /flutter_charset_detector_darwin/darwin/Assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amake/flutter_charset_detector/5d32e065b12bd48765db9122f99e20af8bbab5c1/flutter_charset_detector_darwin/darwin/Assets/.gitkeep -------------------------------------------------------------------------------- /flutter_charset_detector_darwin/darwin/Classes/FlutterCharsetDetectorPlugin.h: -------------------------------------------------------------------------------- 1 | #if TARGET_OS_IOS 2 | #import 3 | #elif TARGET_OS_OSX 4 | #import 5 | #endif 6 | 7 | @interface FlutterCharsetDetectorPlugin : NSObject 8 | @end 9 | -------------------------------------------------------------------------------- /flutter_charset_detector_darwin/darwin/Classes/FlutterCharsetDetectorPlugin.m: -------------------------------------------------------------------------------- 1 | #import "FlutterCharsetDetectorPlugin.h" 2 | #if __has_include() 3 | #import 4 | #else 5 | // Support project import fallback if the generated compatibility header 6 | // is not copied when this plugin is created as a library. 7 | // https://forums.swift.org/t/swift-static-libraries-dont-copy-generated-objective-c-header/19816 8 | #import "flutter_charset_detector_darwin-Swift.h" 9 | #endif 10 | 11 | @implementation FlutterCharsetDetectorPlugin 12 | + (void)registerWithRegistrar:(NSObject*)registrar { 13 | [SwiftFlutterCharsetDetectorPlugin registerWithRegistrar:registrar]; 14 | } 15 | @end 16 | -------------------------------------------------------------------------------- /flutter_charset_detector_darwin/darwin/Classes/SwiftFlutterCharsetDetectorPlugin.swift: -------------------------------------------------------------------------------- 1 | #if os(iOS) 2 | import Flutter 3 | #elseif os(macOS) 4 | import FlutterMacOS 5 | #endif 6 | import UniversalDetector2 7 | 8 | public class SwiftFlutterCharsetDetectorPlugin: NSObject, FlutterPlugin { 9 | public static func register(with registrar: FlutterPluginRegistrar) { 10 | #if os(iOS) 11 | let messenger = registrar.messenger() 12 | #else 13 | let messenger = registrar.messenger 14 | #endif 15 | let channel = FlutterMethodChannel(name: "flutter_charset_detector", binaryMessenger: messenger) 16 | let instance = SwiftFlutterCharsetDetectorPlugin() 17 | registrar.addMethodCallDelegate(instance, channel: channel) 18 | } 19 | 20 | public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) { 21 | switch call.method { 22 | case "autoDecode": 23 | handleAutoDecode(call, result) 24 | case "detect": 25 | handleDetect(call, result) 26 | default: 27 | result(FlutterError(code: "UnsupportedMethod", message: "\(call.method) is not supported", details: nil)) 28 | } 29 | } 30 | 31 | func handleAutoDecode(_ call: FlutterMethodCall, _ result: @escaping FlutterResult) { 32 | guard let args = call.arguments as? [String:Any?] else { 33 | result(FlutterError(code: "MissingArgs", message: "Required arguments missing", details: "\(call.method) requires 'data'")) 34 | return 35 | } 36 | guard let data = args["data"] as? FlutterStandardTypedData else { 37 | result(FlutterError(code: "MissingArg", message: "Required argument missing", details: "\(call.method) requires 'data'")) 38 | return 39 | } 40 | // Elsewhere in the plugin we use the term "charset" instead of 41 | // "encoding", but for consistency with iOS APIs we use the term in a 42 | // limited capacity here 43 | guard let encodingName = UniversalDetector.encodingAsString(with: data.data) else { 44 | result(FlutterError(code: "DetectionFailed", message: "The charset could not be detected", details: nil)) 45 | return 46 | } 47 | let encoding = CFStringConvertIANACharSetNameToEncoding(encodingName as CFString) 48 | guard encoding != kCFStringEncodingInvalidId else { 49 | result(FlutterError(code: "UnsupportedCharset", message: "The detected charset \(encodingName) is not supported.", details: nil)) 50 | return 51 | } 52 | let nsEncoding = CFStringConvertEncodingToNSStringEncoding(encoding) 53 | guard let decoded = NSString(data: data.data, encoding: nsEncoding) else { 54 | result(FlutterError(code: "DecodingFailed", message: "The data could not be decoded", details: "Detected charset: \(encodingName)")) 55 | return 56 | } 57 | result([ 58 | "charset": encodingName, 59 | "string": decoded 60 | ]) 61 | } 62 | 63 | func handleDetect(_ call: FlutterMethodCall, _ result: @escaping FlutterResult) { 64 | guard let args = call.arguments as? [String:Any?] else { 65 | result(FlutterError(code: "MissingArgs", message: "Required arguments missing", details: "\(call.method) requires 'data'")) 66 | return 67 | } 68 | guard let data = args["data"] as? FlutterStandardTypedData else { 69 | result(FlutterError(code: "MissingArg", message: "Required argument missing", details: "\(call.method) requires 'data'")) 70 | return 71 | } 72 | // Elsewhere in the plugin we use the term "charset" instead of 73 | // "encoding", but for consistency with iOS APIs we use the term in a 74 | // limited capacity here 75 | guard let encodingName = UniversalDetector.encodingAsString(with: data.data) else { 76 | result(FlutterError(code: "DetectionFailed", message: "The charset could not be detected", details: nil)) 77 | return 78 | } 79 | result(encodingName); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /flutter_charset_detector_darwin/darwin/flutter_charset_detector_darwin.podspec: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html. 4 | # Run `pod lib lint flutter_charset_detector_darwin.podspec' to validate before publishing. 5 | # 6 | Pod::Spec.new do |s| 7 | s.name = 'flutter_charset_detector_darwin' 8 | s.version = '0.0.1' 9 | s.summary = 'A new flutter plugin project.' 10 | s.description = <<~DESC 11 | A new flutter plugin project. 12 | DESC 13 | s.homepage = 'http://example.com' 14 | s.license = { file: '../LICENSE' } 15 | s.author = { 'Your Company' => 'email@example.com' } 16 | s.source = { path: '.' } 17 | s.source_files = 'Classes/**/*' 18 | s.ios.dependency 'Flutter' 19 | s.osx.dependency 'FlutterMacOS' 20 | s.ios.deployment_target = '11.0' 21 | s.osx.deployment_target = '10.14' 22 | 23 | # Flutter.framework does not contain a i386 slice. Only x86_64 simulators are supported. 24 | s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'VALID_ARCHS[sdk=iphonesimulator*]' => 'x86_64' } 25 | s.swift_version = '5.0' 26 | 27 | s.dependency 'UniversalDetector2', '2.0.1' 28 | end 29 | -------------------------------------------------------------------------------- /flutter_charset_detector_darwin/lib/flutter_charset_detector_darwin.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/services.dart'; 2 | import 'package:flutter_charset_detector_platform_interface/decoding_result.dart'; 3 | import 'package:flutter_charset_detector_platform_interface/flutter_charset_detector_platform_interface.dart'; 4 | 5 | class CharsetDetectorDarwin extends CharsetDetectorPlatform { 6 | /// The method channel used to interact with the native platform. 7 | static const MethodChannel _channel = 8 | MethodChannel('flutter_charset_detector'); 9 | 10 | /// Registers this class as the default instance of [CharsetDetectorPlatform] 11 | static void registerWith() => 12 | CharsetDetectorPlatform.instance = CharsetDetectorDarwin(); 13 | 14 | /// Automatically detect the charset of [bytes] and decode to a string. 15 | @override 16 | Future autoDecode(Uint8List bytes) async { 17 | final result = await _channel 18 | .invokeMethod>('autoDecode', {'data': bytes}); 19 | return DecodingResult.fromJson(result!.cast()); 20 | } 21 | 22 | /// Detect and return the charset of [bytes]. 23 | @override 24 | Future detect(Uint8List bytes) async { 25 | return (await _channel.invokeMethod('detect', {'data': bytes}))!; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /flutter_charset_detector_darwin/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | async: 5 | dependency: transitive 6 | description: 7 | name: async 8 | sha256: d2872f9c19731c2e5f10444b14686eb7cc85c76274bd6c16e1816bff9a3bab63 9 | url: "https://pub.dev" 10 | source: hosted 11 | version: "2.12.0" 12 | boolean_selector: 13 | dependency: transitive 14 | description: 15 | name: boolean_selector 16 | sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" 17 | url: "https://pub.dev" 18 | source: hosted 19 | version: "2.1.2" 20 | characters: 21 | dependency: transitive 22 | description: 23 | name: characters 24 | sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 25 | url: "https://pub.dev" 26 | source: hosted 27 | version: "1.4.0" 28 | clock: 29 | dependency: transitive 30 | description: 31 | name: clock 32 | sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b 33 | url: "https://pub.dev" 34 | source: hosted 35 | version: "1.1.2" 36 | collection: 37 | dependency: transitive 38 | description: 39 | name: collection 40 | sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" 41 | url: "https://pub.dev" 42 | source: hosted 43 | version: "1.19.1" 44 | fake_async: 45 | dependency: transitive 46 | description: 47 | name: fake_async 48 | sha256: "6a95e56b2449df2273fd8c45a662d6947ce1ebb7aafe80e550a3f68297f3cacc" 49 | url: "https://pub.dev" 50 | source: hosted 51 | version: "1.3.2" 52 | flutter: 53 | dependency: "direct main" 54 | description: flutter 55 | source: sdk 56 | version: "0.0.0" 57 | flutter_charset_detector_platform_interface: 58 | dependency: "direct main" 59 | description: 60 | name: flutter_charset_detector_platform_interface 61 | sha256: "1c09ed7b314a5a9dde76057b98b7d35458ba881eed03d5e5b6f7f74b4869d18c" 62 | url: "https://pub.dev" 63 | source: hosted 64 | version: "1.1.0" 65 | flutter_lints: 66 | dependency: "direct dev" 67 | description: 68 | name: flutter_lints 69 | sha256: "5398f14efa795ffb7a33e9b6a08798b26a180edac4ad7db3f231e40f82ce11e1" 70 | url: "https://pub.dev" 71 | source: hosted 72 | version: "5.0.0" 73 | flutter_test: 74 | dependency: "direct dev" 75 | description: flutter 76 | source: sdk 77 | version: "0.0.0" 78 | leak_tracker: 79 | dependency: transitive 80 | description: 81 | name: leak_tracker 82 | sha256: c35baad643ba394b40aac41080300150a4f08fd0fd6a10378f8f7c6bc161acec 83 | url: "https://pub.dev" 84 | source: hosted 85 | version: "10.0.8" 86 | leak_tracker_flutter_testing: 87 | dependency: transitive 88 | description: 89 | name: leak_tracker_flutter_testing 90 | sha256: f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573 91 | url: "https://pub.dev" 92 | source: hosted 93 | version: "3.0.9" 94 | leak_tracker_testing: 95 | dependency: transitive 96 | description: 97 | name: leak_tracker_testing 98 | sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" 99 | url: "https://pub.dev" 100 | source: hosted 101 | version: "3.0.1" 102 | lints: 103 | dependency: transitive 104 | description: 105 | name: lints 106 | sha256: c35bb79562d980e9a453fc715854e1ed39e24e7d0297a880ef54e17f9874a9d7 107 | url: "https://pub.dev" 108 | source: hosted 109 | version: "5.1.1" 110 | matcher: 111 | dependency: transitive 112 | description: 113 | name: matcher 114 | sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 115 | url: "https://pub.dev" 116 | source: hosted 117 | version: "0.12.17" 118 | material_color_utilities: 119 | dependency: transitive 120 | description: 121 | name: material_color_utilities 122 | sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec 123 | url: "https://pub.dev" 124 | source: hosted 125 | version: "0.11.1" 126 | meta: 127 | dependency: transitive 128 | description: 129 | name: meta 130 | sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c 131 | url: "https://pub.dev" 132 | source: hosted 133 | version: "1.16.0" 134 | path: 135 | dependency: transitive 136 | description: 137 | name: path 138 | sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" 139 | url: "https://pub.dev" 140 | source: hosted 141 | version: "1.9.1" 142 | plugin_platform_interface: 143 | dependency: transitive 144 | description: 145 | name: plugin_platform_interface 146 | sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" 147 | url: "https://pub.dev" 148 | source: hosted 149 | version: "2.1.8" 150 | sky_engine: 151 | dependency: transitive 152 | description: flutter 153 | source: sdk 154 | version: "0.0.0" 155 | source_span: 156 | dependency: transitive 157 | description: 158 | name: source_span 159 | sha256: "254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c" 160 | url: "https://pub.dev" 161 | source: hosted 162 | version: "1.10.1" 163 | stack_trace: 164 | dependency: transitive 165 | description: 166 | name: stack_trace 167 | sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" 168 | url: "https://pub.dev" 169 | source: hosted 170 | version: "1.12.1" 171 | stream_channel: 172 | dependency: transitive 173 | description: 174 | name: stream_channel 175 | sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" 176 | url: "https://pub.dev" 177 | source: hosted 178 | version: "2.1.4" 179 | string_scanner: 180 | dependency: transitive 181 | description: 182 | name: string_scanner 183 | sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" 184 | url: "https://pub.dev" 185 | source: hosted 186 | version: "1.4.1" 187 | term_glyph: 188 | dependency: transitive 189 | description: 190 | name: term_glyph 191 | sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" 192 | url: "https://pub.dev" 193 | source: hosted 194 | version: "1.2.2" 195 | test_api: 196 | dependency: transitive 197 | description: 198 | name: test_api 199 | sha256: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd 200 | url: "https://pub.dev" 201 | source: hosted 202 | version: "0.7.4" 203 | vector_math: 204 | dependency: transitive 205 | description: 206 | name: vector_math 207 | sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" 208 | url: "https://pub.dev" 209 | source: hosted 210 | version: "2.1.4" 211 | vm_service: 212 | dependency: transitive 213 | description: 214 | name: vm_service 215 | sha256: "0968250880a6c5fe7edc067ed0a13d4bae1577fe2771dcf3010d52c4a9d3ca14" 216 | url: "https://pub.dev" 217 | source: hosted 218 | version: "14.3.1" 219 | sdks: 220 | dart: ">=3.7.0-0 <4.0.0" 221 | flutter: ">=3.18.0-18.0.pre.54" 222 | -------------------------------------------------------------------------------- /flutter_charset_detector_darwin/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_charset_detector_darwin 2 | description: Darwin implementation of the flutter_charset_detector plugin. 3 | version: 1.1.0 4 | homepage: https://github.com/amake/flutter_charset_detector 5 | 6 | environment: 7 | sdk: '>=3.0.0 <4.0.0' 8 | flutter: '>=3.7.0' 9 | 10 | dependencies: 11 | flutter: 12 | sdk: flutter 13 | flutter_charset_detector_platform_interface: ^1.1.0 14 | # flutter_charset_detector_platform_interface: 15 | # path: ../flutter_charset_detector_platform_interface 16 | 17 | dev_dependencies: 18 | flutter_lints: ^5.0.0 19 | flutter_test: 20 | sdk: flutter 21 | 22 | flutter: 23 | plugin: 24 | implements: flutter_charset_detector 25 | platforms: 26 | ios: 27 | pluginClass: FlutterCharsetDetectorPlugin 28 | sharedDarwinSource: true 29 | macos: 30 | pluginClass: FlutterCharsetDetectorPlugin 31 | sharedDarwinSource: true 32 | -------------------------------------------------------------------------------- /flutter_charset_detector_platform_interface/.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: 81a45ec2e5f80fa71d5135f1702ce540558b416d 8 | channel: beta 9 | 10 | project_type: package 11 | -------------------------------------------------------------------------------- /flutter_charset_detector_platform_interface/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 1.1.0 2 | 3 | * Add `detect` method to obtain the detected charset without decoding the 4 | supplied bytes 5 | 6 | ## 1.0.0 7 | 8 | * Initial release 9 | -------------------------------------------------------------------------------- /flutter_charset_detector_platform_interface/README.md: -------------------------------------------------------------------------------- 1 | # flutter\_charset\_detector\_platform\_interface 2 | 3 | A common platform interface for the [`flutter_charset_detector`][1] plugin. 4 | 5 | This interface allows platform-specific implementations of the 6 | `flutter_charset_detector` plugin, as well as the plugin itself, to ensure they 7 | are supporting the same interface. 8 | 9 | # Usage 10 | 11 | To implement a new platform-specific implementation of 12 | `flutter_charset_detector`, extend [`CharsetDetectorPlatform`][2] with an 13 | implementation that performs the platform-specific behavior, and when you 14 | register your plugin, set the default `CharsetDetectorPlatform` by calling 15 | `CharsetDetectorPlatform.instance = MyPlatformCharsetDetector()`. 16 | 17 | [1]: ../ 18 | [2]: lib/flutter_charset_detector_platform_interface.dart 19 | -------------------------------------------------------------------------------- /flutter_charset_detector_platform_interface/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:flutter_lints/flutter.yaml 2 | 3 | analyzer: 4 | language: 5 | strict-casts: true 6 | strict-inference: true 7 | strict-raw-types: true 8 | -------------------------------------------------------------------------------- /flutter_charset_detector_platform_interface/lib/decoding_result.dart: -------------------------------------------------------------------------------- 1 | /// The result of decoding bytes to a string 2 | class DecodingResult { 3 | DecodingResult.fromJson(Map json) 4 | : this._( 5 | json['charset'] as String, 6 | json['string'] as String, 7 | ); 8 | 9 | DecodingResult._(this.charset, this.string); 10 | 11 | /// The original charset of [string] 12 | final String charset; 13 | 14 | /// The decoded string 15 | final String string; 16 | } 17 | -------------------------------------------------------------------------------- /flutter_charset_detector_platform_interface/lib/flutter_charset_detector_platform_interface.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:typed_data'; 3 | 4 | import 'package:flutter_charset_detector_platform_interface/decoding_result.dart'; 5 | import 'package:flutter_charset_detector_platform_interface/src/method_channel_charset_detector.dart'; 6 | import 'package:plugin_platform_interface/plugin_platform_interface.dart'; 7 | 8 | abstract class CharsetDetectorPlatform extends PlatformInterface { 9 | /// Constructs a CharsetDetectorPlatform. 10 | CharsetDetectorPlatform() : super(token: _token); 11 | 12 | static final Object _token = Object(); 13 | 14 | static CharsetDetectorPlatform _instance = MethodChannelCharsetDetector(); 15 | 16 | /// The default instance of [CharsetDetectorPlatform] to use. 17 | /// 18 | /// Defaults to [MethodChannelCharsetDetector]. 19 | static CharsetDetectorPlatform get instance => _instance; 20 | 21 | /// Platform-specific plugins should set this with their own platform-specific 22 | /// class that extends [CharsetDetectorPlatform] when they register 23 | /// themselves. 24 | static set instance(CharsetDetectorPlatform instance) { 25 | PlatformInterface.verify(instance, _token); 26 | _instance = instance; 27 | } 28 | 29 | /// Automatically detect the charset of [bytes] and decode to a string. 30 | Future autoDecode(Uint8List bytes) => 31 | throw UnimplementedError('autoDecode() has not been implemented.'); 32 | 33 | /// Detect and return the charset of [bytes]. 34 | Future detect(Uint8List bytes) => 35 | throw UnimplementedError('detect() has not been implemented.'); 36 | } 37 | -------------------------------------------------------------------------------- /flutter_charset_detector_platform_interface/lib/src/method_channel_charset_detector.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/services.dart'; 2 | import 'package:flutter_charset_detector_platform_interface/decoding_result.dart'; 3 | import 'package:flutter_charset_detector_platform_interface/flutter_charset_detector_platform_interface.dart'; 4 | 5 | /// An implementation of [CharsetDetectorPlatform] that uses method channels. 6 | class MethodChannelCharsetDetector extends CharsetDetectorPlatform { 7 | /// The method channel used to interact with the native platform. 8 | static const MethodChannel _channel = 9 | MethodChannel('flutter_charset_detector'); 10 | 11 | /// Automatically detect the charset of [bytes] and decode to a string. 12 | @override 13 | Future autoDecode(Uint8List bytes) async { 14 | final result = await _channel 15 | .invokeMethod>('autoDecode', {'data': bytes}); 16 | return DecodingResult.fromJson(result!.cast()); 17 | } 18 | 19 | /// Detect the charset of [bytes] and return just the encoding name. 20 | @override 21 | Future detect(Uint8List bytes) async { 22 | return (await _channel.invokeMethod('detect', {'data': bytes}))!; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /flutter_charset_detector_platform_interface/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | async: 5 | dependency: transitive 6 | description: 7 | name: async 8 | sha256: d2872f9c19731c2e5f10444b14686eb7cc85c76274bd6c16e1816bff9a3bab63 9 | url: "https://pub.dev" 10 | source: hosted 11 | version: "2.12.0" 12 | boolean_selector: 13 | dependency: transitive 14 | description: 15 | name: boolean_selector 16 | sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" 17 | url: "https://pub.dev" 18 | source: hosted 19 | version: "2.1.2" 20 | characters: 21 | dependency: transitive 22 | description: 23 | name: characters 24 | sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 25 | url: "https://pub.dev" 26 | source: hosted 27 | version: "1.4.0" 28 | clock: 29 | dependency: transitive 30 | description: 31 | name: clock 32 | sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b 33 | url: "https://pub.dev" 34 | source: hosted 35 | version: "1.1.2" 36 | collection: 37 | dependency: transitive 38 | description: 39 | name: collection 40 | sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" 41 | url: "https://pub.dev" 42 | source: hosted 43 | version: "1.19.1" 44 | fake_async: 45 | dependency: transitive 46 | description: 47 | name: fake_async 48 | sha256: "6a95e56b2449df2273fd8c45a662d6947ce1ebb7aafe80e550a3f68297f3cacc" 49 | url: "https://pub.dev" 50 | source: hosted 51 | version: "1.3.2" 52 | flutter: 53 | dependency: "direct main" 54 | description: flutter 55 | source: sdk 56 | version: "0.0.0" 57 | flutter_lints: 58 | dependency: "direct dev" 59 | description: 60 | name: flutter_lints 61 | sha256: "5398f14efa795ffb7a33e9b6a08798b26a180edac4ad7db3f231e40f82ce11e1" 62 | url: "https://pub.dev" 63 | source: hosted 64 | version: "5.0.0" 65 | flutter_test: 66 | dependency: "direct dev" 67 | description: flutter 68 | source: sdk 69 | version: "0.0.0" 70 | leak_tracker: 71 | dependency: transitive 72 | description: 73 | name: leak_tracker 74 | sha256: c35baad643ba394b40aac41080300150a4f08fd0fd6a10378f8f7c6bc161acec 75 | url: "https://pub.dev" 76 | source: hosted 77 | version: "10.0.8" 78 | leak_tracker_flutter_testing: 79 | dependency: transitive 80 | description: 81 | name: leak_tracker_flutter_testing 82 | sha256: f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573 83 | url: "https://pub.dev" 84 | source: hosted 85 | version: "3.0.9" 86 | leak_tracker_testing: 87 | dependency: transitive 88 | description: 89 | name: leak_tracker_testing 90 | sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" 91 | url: "https://pub.dev" 92 | source: hosted 93 | version: "3.0.1" 94 | lints: 95 | dependency: transitive 96 | description: 97 | name: lints 98 | sha256: c35bb79562d980e9a453fc715854e1ed39e24e7d0297a880ef54e17f9874a9d7 99 | url: "https://pub.dev" 100 | source: hosted 101 | version: "5.1.1" 102 | matcher: 103 | dependency: transitive 104 | description: 105 | name: matcher 106 | sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 107 | url: "https://pub.dev" 108 | source: hosted 109 | version: "0.12.17" 110 | material_color_utilities: 111 | dependency: transitive 112 | description: 113 | name: material_color_utilities 114 | sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec 115 | url: "https://pub.dev" 116 | source: hosted 117 | version: "0.11.1" 118 | meta: 119 | dependency: transitive 120 | description: 121 | name: meta 122 | sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c 123 | url: "https://pub.dev" 124 | source: hosted 125 | version: "1.16.0" 126 | path: 127 | dependency: transitive 128 | description: 129 | name: path 130 | sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" 131 | url: "https://pub.dev" 132 | source: hosted 133 | version: "1.9.1" 134 | plugin_platform_interface: 135 | dependency: "direct main" 136 | description: 137 | name: plugin_platform_interface 138 | sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" 139 | url: "https://pub.dev" 140 | source: hosted 141 | version: "2.1.8" 142 | sky_engine: 143 | dependency: transitive 144 | description: flutter 145 | source: sdk 146 | version: "0.0.0" 147 | source_span: 148 | dependency: transitive 149 | description: 150 | name: source_span 151 | sha256: "254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c" 152 | url: "https://pub.dev" 153 | source: hosted 154 | version: "1.10.1" 155 | stack_trace: 156 | dependency: transitive 157 | description: 158 | name: stack_trace 159 | sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" 160 | url: "https://pub.dev" 161 | source: hosted 162 | version: "1.12.1" 163 | stream_channel: 164 | dependency: transitive 165 | description: 166 | name: stream_channel 167 | sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" 168 | url: "https://pub.dev" 169 | source: hosted 170 | version: "2.1.4" 171 | string_scanner: 172 | dependency: transitive 173 | description: 174 | name: string_scanner 175 | sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" 176 | url: "https://pub.dev" 177 | source: hosted 178 | version: "1.4.1" 179 | term_glyph: 180 | dependency: transitive 181 | description: 182 | name: term_glyph 183 | sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" 184 | url: "https://pub.dev" 185 | source: hosted 186 | version: "1.2.2" 187 | test_api: 188 | dependency: transitive 189 | description: 190 | name: test_api 191 | sha256: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd 192 | url: "https://pub.dev" 193 | source: hosted 194 | version: "0.7.4" 195 | vector_math: 196 | dependency: transitive 197 | description: 198 | name: vector_math 199 | sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" 200 | url: "https://pub.dev" 201 | source: hosted 202 | version: "2.1.4" 203 | vm_service: 204 | dependency: transitive 205 | description: 206 | name: vm_service 207 | sha256: "0968250880a6c5fe7edc067ed0a13d4bae1577fe2771dcf3010d52c4a9d3ca14" 208 | url: "https://pub.dev" 209 | source: hosted 210 | version: "14.3.1" 211 | sdks: 212 | dart: ">=3.7.0-0 <4.0.0" 213 | flutter: ">=3.18.0-18.0.pre.54" 214 | -------------------------------------------------------------------------------- /flutter_charset_detector_platform_interface/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_charset_detector_platform_interface 2 | description: A common platform interface for the flutter_charset_detector plugin. 3 | version: 1.1.0 4 | homepage: https://github.com/amake/flutter_charset_detector 5 | 6 | environment: 7 | sdk: '>=2.12.0 <4.0.0' 8 | flutter: '>=1.20.0' 9 | 10 | dependencies: 11 | flutter: 12 | sdk: flutter 13 | plugin_platform_interface: ^2.1.0 14 | 15 | dev_dependencies: 16 | flutter_lints: ^5.0.0 17 | flutter_test: 18 | sdk: flutter 19 | -------------------------------------------------------------------------------- /flutter_charset_detector_web/.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 | # Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. 26 | /pubspec.lock 27 | **/doc/api/ 28 | .dart_tool/ 29 | build/ 30 | -------------------------------------------------------------------------------- /flutter_charset_detector_web/.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: "db7ef5bf9f59442b0e200a90587e8fa5e0c6336a" 8 | channel: "stable" 9 | 10 | project_type: plugin 11 | 12 | # Tracks metadata for the flutter migrate command 13 | migration: 14 | platforms: 15 | - platform: root 16 | create_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a 17 | base_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a 18 | - platform: web 19 | create_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a 20 | base_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a 21 | 22 | # User provided section 23 | 24 | # List of Local paths (relative to this file) that should be 25 | # ignored by the migrate tool. 26 | # 27 | # Files that are not part of the templates will be ignored by default. 28 | unmanaged_files: 29 | - 'lib/main.dart' 30 | - 'ios/Runner.xcodeproj/project.pbxproj' 31 | -------------------------------------------------------------------------------- /flutter_charset_detector_web/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 2.0.0 2 | 3 | * Switch from `js` to `dart:js_interop` 4 | * Require Dart 3.3+ 5 | 6 | ## 1.2.0 7 | 8 | * Add `detect` method to obtain the detected charset without decoding the 9 | supplied bytes 10 | 11 | ## 1.1.0 12 | 13 | * Bump jschardet to 3.1.0 14 | 15 | ## 1.0.3 16 | 17 | * Use `js` version 0.7.1 18 | 19 | ## 1.0.2 20 | 21 | * Fix registration of web implementation 22 | * Fix `autoDecode` to actually decode 23 | 24 | ## 1.0.1 25 | 26 | * Use `js` version 0.6.4 27 | 28 | ## 1.0.0 29 | 30 | * Initial release 31 | -------------------------------------------------------------------------------- /flutter_charset_detector_web/README.md: -------------------------------------------------------------------------------- 1 | # flutter\_charset\_detector\_web 2 | 3 | The Web implementation of [`flutter_charset_detector`][1]. 4 | 5 | ## Usage 6 | 7 | To make it work properly on the Web platform, you need to add the 8 | `jschardet.min.js` file inside the of your `web/index.html` file: 9 | 10 | ```html 11 | 12 | 13 | 14 | 15 | 16 | ``` 17 | 18 | This package is [endorsed][2], which means you can simply use 19 | `flutter_charset_detector` normally. This package will be automatically included 20 | in your app when you do. 21 | 22 | [1]: https://pub.dev/packages/flutter_charset_detector 23 | [2]: https://flutter.dev/docs/development/packages-and-plugins/developing-packages#endorsed-federated-plugin 24 | -------------------------------------------------------------------------------- /flutter_charset_detector_web/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:flutter_lints/flutter.yaml 2 | 3 | analyzer: 4 | language: 5 | strict-casts: true 6 | strict-inference: true 7 | strict-raw-types: true 8 | -------------------------------------------------------------------------------- /flutter_charset_detector_web/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 | .pub-cache/ 31 | .pub/ 32 | /build/ 33 | 34 | # Symbolication related 35 | app.*.symbols 36 | 37 | # Obfuscation related 38 | app.*.map.json 39 | 40 | # Android Studio will place build artifacts here 41 | /android/app/debug 42 | /android/app/profile 43 | /android/app/release 44 | -------------------------------------------------------------------------------- /flutter_charset_detector_web/example/README.md: -------------------------------------------------------------------------------- 1 | # flutter_charset_detector_web_example 2 | 3 | Demonstrates how to use the flutter_charset_detector_web plugin. 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://docs.flutter.dev/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) 13 | 14 | For help getting started with Flutter development, view the 15 | [online documentation](https://docs.flutter.dev/), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /flutter_charset_detector_web/example/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:flutter_lints/flutter.yaml 2 | 3 | linter: 4 | rules: 5 | -------------------------------------------------------------------------------- /flutter_charset_detector_web/example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:file_picker/file_picker.dart'; 4 | import 'package:flutter/foundation.dart'; 5 | import 'package:flutter/material.dart'; 6 | import 'package:flutter/services.dart'; 7 | import 'package:flutter_charset_detector_web/flutter_charset_detector_web.dart'; 8 | 9 | void main() { 10 | runApp(const MyApp()); 11 | } 12 | 13 | class MyApp extends StatefulWidget { 14 | const MyApp({super.key}); 15 | 16 | @override 17 | State createState() => _MyAppState(); 18 | } 19 | 20 | class _MyAppState extends State { 21 | final _charsetDetectorWeb = CharsetDetectorWeb(); 22 | String? _fileCharset; 23 | 24 | @override 25 | void initState() { 26 | super.initState(); 27 | } 28 | 29 | Future _detectFileCharset(Uint8List bytes) async { 30 | String fileCharset; 31 | 32 | try { 33 | final decodingResult = await _charsetDetectorWeb.autoDecode(bytes); 34 | fileCharset = decodingResult.charset; 35 | final detectResult = await _charsetDetectorWeb.detect(bytes); 36 | debugPrint('detectResult: $detectResult'); 37 | } on PlatformException { 38 | fileCharset = 'Failed to get charset.'; 39 | } 40 | 41 | if (!mounted) return; 42 | 43 | setState(() { 44 | _fileCharset = fileCharset; 45 | }); 46 | } 47 | 48 | @override 49 | Widget build(BuildContext context) { 50 | return MaterialApp( 51 | home: Scaffold( 52 | appBar: AppBar( 53 | title: const Text('Plugin example app'), 54 | ), 55 | body: Center( 56 | child: Column( 57 | children: [ 58 | TextButton( 59 | onPressed: () async { 60 | final filesResult = await FilePicker.platform 61 | .pickFiles(type: FileType.any, withData: kIsWeb); 62 | 63 | if (filesResult != null && filesResult.files.isNotEmpty) { 64 | final fileInfoResults = filesResult.files.first; 65 | _detectFileCharset(fileInfoResults.bytes!); 66 | } 67 | }, 68 | child: const Text('Select File')), 69 | Text('File Charset: $_fileCharset\n') 70 | ], 71 | ), 72 | ), 73 | ), 74 | ); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /flutter_charset_detector_web/example/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | async: 5 | dependency: transitive 6 | description: 7 | name: async 8 | sha256: d2872f9c19731c2e5f10444b14686eb7cc85c76274bd6c16e1816bff9a3bab63 9 | url: "https://pub.dev" 10 | source: hosted 11 | version: "2.12.0" 12 | boolean_selector: 13 | dependency: transitive 14 | description: 15 | name: boolean_selector 16 | sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" 17 | url: "https://pub.dev" 18 | source: hosted 19 | version: "2.1.2" 20 | characters: 21 | dependency: transitive 22 | description: 23 | name: characters 24 | sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 25 | url: "https://pub.dev" 26 | source: hosted 27 | version: "1.4.0" 28 | clock: 29 | dependency: transitive 30 | description: 31 | name: clock 32 | sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b 33 | url: "https://pub.dev" 34 | source: hosted 35 | version: "1.1.2" 36 | collection: 37 | dependency: transitive 38 | description: 39 | name: collection 40 | sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" 41 | url: "https://pub.dev" 42 | source: hosted 43 | version: "1.19.1" 44 | cross_file: 45 | dependency: transitive 46 | description: 47 | name: cross_file 48 | sha256: "7caf6a750a0c04effbb52a676dce9a4a592e10ad35c34d6d2d0e4811160d5670" 49 | url: "https://pub.dev" 50 | source: hosted 51 | version: "0.3.4+2" 52 | cupertino_icons: 53 | dependency: "direct main" 54 | description: 55 | name: cupertino_icons 56 | sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 57 | url: "https://pub.dev" 58 | source: hosted 59 | version: "1.0.8" 60 | fake_async: 61 | dependency: transitive 62 | description: 63 | name: fake_async 64 | sha256: "6a95e56b2449df2273fd8c45a662d6947ce1ebb7aafe80e550a3f68297f3cacc" 65 | url: "https://pub.dev" 66 | source: hosted 67 | version: "1.3.2" 68 | ffi: 69 | dependency: transitive 70 | description: 71 | name: ffi 72 | sha256: "289279317b4b16eb2bb7e271abccd4bf84ec9bdcbe999e278a94b804f5630418" 73 | url: "https://pub.dev" 74 | source: hosted 75 | version: "2.1.4" 76 | file: 77 | dependency: transitive 78 | description: 79 | name: file 80 | sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 81 | url: "https://pub.dev" 82 | source: hosted 83 | version: "7.0.1" 84 | file_picker: 85 | dependency: "direct main" 86 | description: 87 | name: file_picker 88 | sha256: ab13ae8ef5580a411c458d6207b6774a6c237d77ac37011b13994879f68a8810 89 | url: "https://pub.dev" 90 | source: hosted 91 | version: "8.3.7" 92 | flutter: 93 | dependency: "direct main" 94 | description: flutter 95 | source: sdk 96 | version: "0.0.0" 97 | flutter_charset_detector_platform_interface: 98 | dependency: transitive 99 | description: 100 | name: flutter_charset_detector_platform_interface 101 | sha256: "1c09ed7b314a5a9dde76057b98b7d35458ba881eed03d5e5b6f7f74b4869d18c" 102 | url: "https://pub.dev" 103 | source: hosted 104 | version: "1.1.0" 105 | flutter_charset_detector_web: 106 | dependency: "direct main" 107 | description: 108 | path: ".." 109 | relative: true 110 | source: path 111 | version: "2.0.0" 112 | flutter_driver: 113 | dependency: transitive 114 | description: flutter 115 | source: sdk 116 | version: "0.0.0" 117 | flutter_lints: 118 | dependency: "direct dev" 119 | description: 120 | name: flutter_lints 121 | sha256: "3f41d009ba7172d5ff9be5f6e6e6abb4300e263aab8866d2a0842ed2a70f8f0c" 122 | url: "https://pub.dev" 123 | source: hosted 124 | version: "4.0.0" 125 | flutter_plugin_android_lifecycle: 126 | dependency: transitive 127 | description: 128 | name: flutter_plugin_android_lifecycle 129 | sha256: "615a505aef59b151b46bbeef55b36ce2b6ed299d160c51d84281946f0aa0ce0e" 130 | url: "https://pub.dev" 131 | source: hosted 132 | version: "2.0.24" 133 | flutter_test: 134 | dependency: "direct dev" 135 | description: flutter 136 | source: sdk 137 | version: "0.0.0" 138 | flutter_web_plugins: 139 | dependency: transitive 140 | description: flutter 141 | source: sdk 142 | version: "0.0.0" 143 | fuchsia_remote_debug_protocol: 144 | dependency: transitive 145 | description: flutter 146 | source: sdk 147 | version: "0.0.0" 148 | integration_test: 149 | dependency: "direct dev" 150 | description: flutter 151 | source: sdk 152 | version: "0.0.0" 153 | leak_tracker: 154 | dependency: transitive 155 | description: 156 | name: leak_tracker 157 | sha256: c35baad643ba394b40aac41080300150a4f08fd0fd6a10378f8f7c6bc161acec 158 | url: "https://pub.dev" 159 | source: hosted 160 | version: "10.0.8" 161 | leak_tracker_flutter_testing: 162 | dependency: transitive 163 | description: 164 | name: leak_tracker_flutter_testing 165 | sha256: f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573 166 | url: "https://pub.dev" 167 | source: hosted 168 | version: "3.0.9" 169 | leak_tracker_testing: 170 | dependency: transitive 171 | description: 172 | name: leak_tracker_testing 173 | sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" 174 | url: "https://pub.dev" 175 | source: hosted 176 | version: "3.0.1" 177 | lints: 178 | dependency: transitive 179 | description: 180 | name: lints 181 | sha256: "976c774dd944a42e83e2467f4cc670daef7eed6295b10b36ae8c85bcbf828235" 182 | url: "https://pub.dev" 183 | source: hosted 184 | version: "4.0.0" 185 | matcher: 186 | dependency: transitive 187 | description: 188 | name: matcher 189 | sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 190 | url: "https://pub.dev" 191 | source: hosted 192 | version: "0.12.17" 193 | material_color_utilities: 194 | dependency: transitive 195 | description: 196 | name: material_color_utilities 197 | sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec 198 | url: "https://pub.dev" 199 | source: hosted 200 | version: "0.11.1" 201 | meta: 202 | dependency: transitive 203 | description: 204 | name: meta 205 | sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c 206 | url: "https://pub.dev" 207 | source: hosted 208 | version: "1.16.0" 209 | path: 210 | dependency: transitive 211 | description: 212 | name: path 213 | sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" 214 | url: "https://pub.dev" 215 | source: hosted 216 | version: "1.9.1" 217 | platform: 218 | dependency: transitive 219 | description: 220 | name: platform 221 | sha256: "5d6b1b0036a5f331ebc77c850ebc8506cbc1e9416c27e59b439f917a902a4984" 222 | url: "https://pub.dev" 223 | source: hosted 224 | version: "3.1.6" 225 | plugin_platform_interface: 226 | dependency: transitive 227 | description: 228 | name: plugin_platform_interface 229 | sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" 230 | url: "https://pub.dev" 231 | source: hosted 232 | version: "2.1.8" 233 | process: 234 | dependency: transitive 235 | description: 236 | name: process 237 | sha256: "107d8be718f120bbba9dcd1e95e3bd325b1b4a4f07db64154635ba03f2567a0d" 238 | url: "https://pub.dev" 239 | source: hosted 240 | version: "5.0.3" 241 | sky_engine: 242 | dependency: transitive 243 | description: flutter 244 | source: sdk 245 | version: "0.0.0" 246 | source_span: 247 | dependency: transitive 248 | description: 249 | name: source_span 250 | sha256: "254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c" 251 | url: "https://pub.dev" 252 | source: hosted 253 | version: "1.10.1" 254 | stack_trace: 255 | dependency: transitive 256 | description: 257 | name: stack_trace 258 | sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" 259 | url: "https://pub.dev" 260 | source: hosted 261 | version: "1.12.1" 262 | stream_channel: 263 | dependency: transitive 264 | description: 265 | name: stream_channel 266 | sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" 267 | url: "https://pub.dev" 268 | source: hosted 269 | version: "2.1.4" 270 | string_scanner: 271 | dependency: transitive 272 | description: 273 | name: string_scanner 274 | sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" 275 | url: "https://pub.dev" 276 | source: hosted 277 | version: "1.4.1" 278 | sync_http: 279 | dependency: transitive 280 | description: 281 | name: sync_http 282 | sha256: "7f0cd72eca000d2e026bcd6f990b81d0ca06022ef4e32fb257b30d3d1014a961" 283 | url: "https://pub.dev" 284 | source: hosted 285 | version: "0.3.1" 286 | term_glyph: 287 | dependency: transitive 288 | description: 289 | name: term_glyph 290 | sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" 291 | url: "https://pub.dev" 292 | source: hosted 293 | version: "1.2.2" 294 | test_api: 295 | dependency: transitive 296 | description: 297 | name: test_api 298 | sha256: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd 299 | url: "https://pub.dev" 300 | source: hosted 301 | version: "0.7.4" 302 | vector_math: 303 | dependency: transitive 304 | description: 305 | name: vector_math 306 | sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" 307 | url: "https://pub.dev" 308 | source: hosted 309 | version: "2.1.4" 310 | vm_service: 311 | dependency: transitive 312 | description: 313 | name: vm_service 314 | sha256: "0968250880a6c5fe7edc067ed0a13d4bae1577fe2771dcf3010d52c4a9d3ca14" 315 | url: "https://pub.dev" 316 | source: hosted 317 | version: "14.3.1" 318 | web: 319 | dependency: transitive 320 | description: 321 | name: web 322 | sha256: cd3543bd5798f6ad290ea73d210f423502e71900302dde696f8bff84bf89a1cb 323 | url: "https://pub.dev" 324 | source: hosted 325 | version: "1.1.0" 326 | webdriver: 327 | dependency: transitive 328 | description: 329 | name: webdriver 330 | sha256: "3d773670966f02a646319410766d3b5e1037efb7f07cc68f844d5e06cd4d61c8" 331 | url: "https://pub.dev" 332 | source: hosted 333 | version: "3.0.4" 334 | win32: 335 | dependency: transitive 336 | description: 337 | name: win32 338 | sha256: b89e6e24d1454e149ab20fbb225af58660f0c0bf4475544650700d8e2da54aef 339 | url: "https://pub.dev" 340 | source: hosted 341 | version: "5.11.0" 342 | sdks: 343 | dart: ">=3.7.0 <4.0.0" 344 | flutter: ">=3.24.0" 345 | -------------------------------------------------------------------------------- /flutter_charset_detector_web/example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_charset_detector_web_example 2 | description: "Demonstrates how to use the flutter_charset_detector_web plugin." 3 | publish_to: 'none' 4 | 5 | environment: 6 | sdk: '>=3.2.0 <4.0.0' 7 | 8 | dependencies: 9 | flutter: 10 | sdk: flutter 11 | 12 | flutter_charset_detector_web: 13 | path: ../ 14 | 15 | cupertino_icons: ^1.0.2 16 | 17 | file_picker: ^8.1.2 18 | 19 | dev_dependencies: 20 | integration_test: 21 | sdk: flutter 22 | flutter_test: 23 | sdk: flutter 24 | 25 | flutter_lints: ^4.0.0 26 | 27 | flutter: 28 | uses-material-design: true 29 | -------------------------------------------------------------------------------- /flutter_charset_detector_web/example/web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amake/flutter_charset_detector/5d32e065b12bd48765db9122f99e20af8bbab5c1/flutter_charset_detector_web/example/web/favicon.png -------------------------------------------------------------------------------- /flutter_charset_detector_web/example/web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amake/flutter_charset_detector/5d32e065b12bd48765db9122f99e20af8bbab5c1/flutter_charset_detector_web/example/web/icons/Icon-192.png -------------------------------------------------------------------------------- /flutter_charset_detector_web/example/web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amake/flutter_charset_detector/5d32e065b12bd48765db9122f99e20af8bbab5c1/flutter_charset_detector_web/example/web/icons/Icon-512.png -------------------------------------------------------------------------------- /flutter_charset_detector_web/example/web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amake/flutter_charset_detector/5d32e065b12bd48765db9122f99e20af8bbab5c1/flutter_charset_detector_web/example/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /flutter_charset_detector_web/example/web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amake/flutter_charset_detector/5d32e065b12bd48765db9122f99e20af8bbab5c1/flutter_charset_detector_web/example/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /flutter_charset_detector_web/example/web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | flutter_charset_detector_web_example 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /flutter_charset_detector_web/example/web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "flutter_charset_detector_web_example", 3 | "short_name": "flutter_charset_detector_web_example", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "background_color": "#0175C2", 7 | "theme_color": "#0175C2", 8 | "description": "Demonstrates how to use the flutter_charset_detector_web plugin.", 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 | -------------------------------------------------------------------------------- /flutter_charset_detector_web/lib/flutter_charset_detector_web.dart: -------------------------------------------------------------------------------- 1 | import 'dart:js_interop'; 2 | 3 | import 'package:flutter/foundation.dart'; 4 | import 'package:flutter_charset_detector_platform_interface/decoding_result.dart'; 5 | import 'package:flutter_charset_detector_platform_interface/flutter_charset_detector_platform_interface.dart'; 6 | import 'package:flutter_charset_detector_web/js_charset_detector.dart' 7 | as jschardet; 8 | import 'package:flutter_charset_detector_web/js_textdecoder.dart'; 9 | import 'package:flutter_web_plugins/flutter_web_plugins.dart'; 10 | 11 | class CharsetDetectorWeb extends CharsetDetectorPlatform { 12 | CharsetDetectorWeb() { 13 | if (kDebugMode) { 14 | jschardet.enableDebug(); 15 | } 16 | } 17 | 18 | /// Registers this class as the default instance of [CharsetDetectorPlatform] 19 | static void registerWith(Registrar registrar) => 20 | CharsetDetectorPlatform.instance = CharsetDetectorWeb(); 21 | 22 | /// Automatically detect the charset of [bytes] and decode to a string. 23 | @override 24 | Future autoDecode(Uint8List bytes) async { 25 | final byteString = String.fromCharCodes(bytes); 26 | final detectedMap = jschardet.detect(byteString.toJS, null); 27 | final decoder = TextDecoder(detectedMap.encoding); 28 | debugPrint( 29 | 'Detected result; ' 30 | 'encoding: ${detectedMap.encoding} (normalized to: ${decoder.encoding}), ' 31 | 'confidence: ${detectedMap.confidence}', 32 | ); 33 | final decodedString = decoder.decode(bytes.toJS); 34 | return DecodingResult.fromJson({ 35 | 'charset': decoder.encoding, 36 | 'string': decodedString, 37 | }); 38 | } 39 | 40 | /// Detect and return the charset of [bytes]. 41 | @override 42 | Future detect(Uint8List bytes) async { 43 | final byteString = String.fromCharCodes(bytes); 44 | final detectedMap = jschardet.detect(byteString.toJS, null); 45 | return detectedMap.encoding; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /flutter_charset_detector_web/lib/js_charset_detector.dart: -------------------------------------------------------------------------------- 1 | import 'dart:js_interop'; 2 | 3 | @JS('jschardet.detect') 4 | external DetectedMap detect(JSAny data, OptionsMap? options); 5 | 6 | @JS('jschardet.detectAll') 7 | external JSArray detectAll(JSAny data, OptionsMap? options); 8 | 9 | @JS('jschardet.enableDebug') 10 | external void enableDebug(); 11 | 12 | extension type DetectedMap._(JSObject o) implements JSObject { 13 | external DetectedMap({String encoding, num confidence}); 14 | external String get encoding; 15 | external num get confidence; 16 | } 17 | 18 | extension type OptionsMap._(JSObject o) implements JSObject { 19 | external OptionsMap( 20 | {num? minimumThreshold, JSArray? detectEncodings}); 21 | external num? get minimumThreshold; 22 | external JSArray? get detectEncodings; 23 | } 24 | -------------------------------------------------------------------------------- /flutter_charset_detector_web/lib/js_textdecoder.dart: -------------------------------------------------------------------------------- 1 | import 'dart:js_interop'; 2 | 3 | extension type TextDecoder._(JSObject o) implements JSObject { 4 | external TextDecoder([String label, TextDecoderOptions options]); 5 | external String decode(JSAny data, [TextDecodeOptions options]); 6 | external String get encoding; 7 | external bool get fatal; 8 | external bool get ignoreBOM; 9 | } 10 | 11 | extension type TextDecoderOptions._(JSObject o) implements JSObject { 12 | external TextDecoderOptions({bool fatal, bool ignoreBOM}); 13 | external bool get fatal; 14 | external bool get ignoreBOM; 15 | } 16 | 17 | extension type TextDecodeOptions._(JSObject o) implements JSObject { 18 | external TextDecodeOptions({bool stream}); 19 | external bool get stream; 20 | } 21 | -------------------------------------------------------------------------------- /flutter_charset_detector_web/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_charset_detector_web 2 | description: Web implementation of the flutter_charset_detector plugin. 3 | version: 2.0.0 4 | homepage: https://github.com/amake/flutter_charset_detector 5 | 6 | environment: 7 | sdk: '>=3.3.0 <4.0.0' 8 | flutter: '>=3.3.0' 9 | 10 | dependencies: 11 | flutter: 12 | sdk: flutter 13 | flutter_web_plugins: 14 | sdk: flutter 15 | flutter_charset_detector_platform_interface: ^1.1.0 16 | # flutter_charset_detector_platform_interface: 17 | # path: ../flutter_charset_detector_platform_interface 18 | 19 | dev_dependencies: 20 | flutter_test: 21 | sdk: flutter 22 | flutter_lints: ^5.0.0 23 | 24 | flutter: 25 | assets: 26 | - packages/flutter_charset_detector_web/assets/web/jschardet.min.js 27 | plugin: 28 | implements: flutter_charset_detector 29 | platforms: 30 | web: 31 | pluginClass: CharsetDetectorWeb 32 | fileName: flutter_charset_detector_web.dart 33 | --------------------------------------------------------------------------------