├── ios
├── Assets
│ └── .gitkeep
├── .gitignore
├── Classes
│ └── FlutterThermalPrinterPlugin.swift
└── flutter_thermal_printer.podspec
├── example
├── linux
│ ├── .gitignore
│ ├── main.cc
│ ├── flutter
│ │ ├── generated_plugin_registrant.cc
│ │ ├── generated_plugin_registrant.h
│ │ ├── generated_plugins.cmake
│ │ └── CMakeLists.txt
│ ├── my_application.h
│ ├── my_application.cc
│ └── CMakeLists.txt
├── ios
│ ├── Runner
│ │ ├── Runner-Bridging-Header.h
│ │ ├── Assets.xcassets
│ │ │ ├── LaunchImage.imageset
│ │ │ │ ├── LaunchImage.png
│ │ │ │ ├── LaunchImage@2x.png
│ │ │ │ ├── LaunchImage@3x.png
│ │ │ │ ├── README.md
│ │ │ │ └── Contents.json
│ │ │ └── AppIcon.appiconset
│ │ │ │ ├── Icon-App-20x20@1x.png
│ │ │ │ ├── Icon-App-20x20@2x.png
│ │ │ │ ├── Icon-App-20x20@3x.png
│ │ │ │ ├── Icon-App-29x29@1x.png
│ │ │ │ ├── Icon-App-29x29@2x.png
│ │ │ │ ├── Icon-App-29x29@3x.png
│ │ │ │ ├── Icon-App-40x40@1x.png
│ │ │ │ ├── Icon-App-40x40@2x.png
│ │ │ │ ├── Icon-App-40x40@3x.png
│ │ │ │ ├── Icon-App-60x60@2x.png
│ │ │ │ ├── Icon-App-60x60@3x.png
│ │ │ │ ├── Icon-App-76x76@1x.png
│ │ │ │ ├── Icon-App-76x76@2x.png
│ │ │ │ ├── Icon-App-1024x1024@1x.png
│ │ │ │ ├── Icon-App-83.5x83.5@2x.png
│ │ │ │ └── Contents.json
│ │ ├── AppDelegate.swift
│ │ ├── Base.lproj
│ │ │ ├── Main.storyboard
│ │ │ └── LaunchScreen.storyboard
│ │ └── Info.plist
│ ├── Flutter
│ │ ├── Debug.xcconfig
│ │ ├── Release.xcconfig
│ │ └── AppFrameworkInfo.plist
│ ├── Runner.xcodeproj
│ │ ├── project.xcworkspace
│ │ │ ├── contents.xcworkspacedata
│ │ │ └── xcshareddata
│ │ │ │ ├── WorkspaceSettings.xcsettings
│ │ │ │ └── IDEWorkspaceChecks.plist
│ │ └── xcshareddata
│ │ │ └── xcschemes
│ │ │ └── Runner.xcscheme
│ ├── Runner.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ ├── WorkspaceSettings.xcsettings
│ │ │ └── IDEWorkspaceChecks.plist
│ ├── .gitignore
│ ├── RunnerTests
│ │ └── RunnerTests.swift
│ ├── Podfile.lock
│ └── Podfile
├── web
│ ├── favicon.png
│ ├── icons
│ │ ├── Icon-192.png
│ │ ├── Icon-512.png
│ │ ├── Icon-maskable-192.png
│ │ └── Icon-maskable-512.png
│ ├── manifest.json
│ └── index.html
├── android
│ ├── gradle.properties
│ ├── app
│ │ ├── src
│ │ │ ├── main
│ │ │ │ ├── res
│ │ │ │ │ ├── mipmap-hdpi
│ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ ├── mipmap-mdpi
│ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ ├── mipmap-xhdpi
│ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ ├── mipmap-xxxhdpi
│ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ ├── drawable
│ │ │ │ │ │ └── launch_background.xml
│ │ │ │ │ ├── drawable-v21
│ │ │ │ │ │ └── launch_background.xml
│ │ │ │ │ ├── values
│ │ │ │ │ │ └── styles.xml
│ │ │ │ │ ├── values-night
│ │ │ │ │ │ └── styles.xml
│ │ │ │ │ └── xml
│ │ │ │ │ │ └── device_filter.xml
│ │ │ │ ├── kotlin
│ │ │ │ │ └── com
│ │ │ │ │ │ └── example
│ │ │ │ │ │ └── flutter_thermal_printer_example
│ │ │ │ │ │ └── MainActivity.kt
│ │ │ │ ├── java
│ │ │ │ │ └── com
│ │ │ │ │ │ └── example
│ │ │ │ │ │ └── flutter_thermal_printer_example
│ │ │ │ │ │ └── MainActivity.java
│ │ │ │ └── AndroidManifest.xml
│ │ │ ├── debug
│ │ │ │ └── AndroidManifest.xml
│ │ │ └── profile
│ │ │ │ └── AndroidManifest.xml
│ │ └── build.gradle
│ ├── gradle
│ │ └── wrapper
│ │ │ └── gradle-wrapper.properties
│ ├── .gitignore
│ ├── build.gradle
│ └── settings.gradle
├── macos
│ ├── Runner
│ │ ├── Configs
│ │ │ ├── Debug.xcconfig
│ │ │ ├── Release.xcconfig
│ │ │ ├── Warnings.xcconfig
│ │ │ └── AppInfo.xcconfig
│ │ ├── Assets.xcassets
│ │ │ └── AppIcon.appiconset
│ │ │ │ ├── app_icon_128.png
│ │ │ │ ├── app_icon_16.png
│ │ │ │ ├── app_icon_256.png
│ │ │ │ ├── app_icon_32.png
│ │ │ │ ├── app_icon_512.png
│ │ │ │ ├── app_icon_64.png
│ │ │ │ ├── app_icon_1024.png
│ │ │ │ └── Contents.json
│ │ ├── AppDelegate.swift
│ │ ├── MainFlutterWindow.swift
│ │ ├── Release.entitlements
│ │ ├── DebugProfile.entitlements
│ │ └── Info.plist
│ ├── .gitignore
│ ├── Flutter
│ │ ├── Flutter-Debug.xcconfig
│ │ ├── Flutter-Release.xcconfig
│ │ └── GeneratedPluginRegistrant.swift
│ ├── Runner.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ ├── Runner.xcodeproj
│ │ ├── project.xcworkspace
│ │ │ └── xcshareddata
│ │ │ │ └── IDEWorkspaceChecks.plist
│ │ └── xcshareddata
│ │ │ └── xcschemes
│ │ │ └── Runner.xcscheme
│ ├── RunnerTests
│ │ └── RunnerTests.swift
│ ├── Podfile.lock
│ └── Podfile
├── windows
│ ├── runner
│ │ ├── resources
│ │ │ └── app_icon.ico
│ │ ├── resource.h
│ │ ├── utils.h
│ │ ├── runner.exe.manifest
│ │ ├── flutter_window.h
│ │ ├── main.cpp
│ │ ├── CMakeLists.txt
│ │ ├── utils.cpp
│ │ ├── flutter_window.cpp
│ │ ├── Runner.rc
│ │ └── win32_window.h
│ ├── .gitignore
│ ├── flutter
│ │ ├── generated_plugin_registrant.h
│ │ ├── generated_plugin_registrant.cc
│ │ ├── generated_plugins.cmake
│ │ └── CMakeLists.txt
│ └── CMakeLists.txt
├── integration_test
│ └── plugin_integration_test.dart
├── README.md
├── .gitignore
├── test
│ └── widget_test.dart
├── analysis_options.yaml
├── .metadata
└── pubspec.yaml
├── android
├── settings.gradle
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── .gitignore
├── src
│ ├── main
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── flutter_thermal_printer
│ │ │ └── FlutterThermalPrinterPlugin.java
│ └── test
│ │ └── java
│ │ └── com
│ │ └── example
│ │ └── flutter_thermal_printer
│ │ └── FlutterThermalPrinterPluginTest.java
├── build.gradle
└── gradlew.bat
├── .gitattributes
├── lib
├── Windows
│ ├── windows_platform.dart
│ ├── windows_stub.dart
│ ├── print_data.dart
│ └── printers_data.dart
├── utils
│ ├── ble_config.dart
│ └── printer.dart
├── network
│ ├── network_print_result.dart
│ └── network_printer.dart
├── flutter_thermal_printer_platform_interface.dart
└── flutter_thermal_printer_method_channel.dart
├── windows
├── .gitignore
├── flutter_thermal_printer_plugin_c_api.cpp
├── include
│ └── flutter_thermal_printer
│ │ └── flutter_thermal_printer_plugin_c_api.h
├── flutter_thermal_printer_plugin.h
├── test
│ └── flutter_thermal_printer_plugin_test.cpp
├── flutter_thermal_printer_plugin.cpp
└── CMakeLists.txt
├── .gitignore
├── .vscode
├── tasks.json
├── c_cpp_properties.json
├── launch.json
└── settings.json
├── test
├── flutter_thermal_printer_method_channel_test.dart
├── mocks
│ └── mock_platform.dart
├── unit
│ ├── network_print_result_test.dart
│ ├── platform_interface_test.dart
│ └── ble_config_test.dart
└── flutter_thermal_printer_test.dart
├── macos
└── flutter_thermal_printer.podspec
├── .metadata
├── LICENSE
├── pubspec.yaml
├── CHANGELOG.md
└── README.md
/ios/Assets/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/example/linux/.gitignore:
--------------------------------------------------------------------------------
1 | flutter/ephemeral
2 |
--------------------------------------------------------------------------------
/android/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'flutter_thermal_printer'
2 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
--------------------------------------------------------------------------------
/example/ios/Runner/Runner-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | #import "GeneratedPluginRegistrant.h"
2 |
--------------------------------------------------------------------------------
/example/web/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunilDevX/flutter_thermal_printer/HEAD/example/web/favicon.png
--------------------------------------------------------------------------------
/example/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx4G
2 | android.useAndroidX=true
3 | android.enableJetifier=true
4 |
--------------------------------------------------------------------------------
/example/macos/Runner/Configs/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "../../Flutter/Flutter-Debug.xcconfig"
2 | #include "Warnings.xcconfig"
3 |
--------------------------------------------------------------------------------
/example/macos/Runner/Configs/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "../../Flutter/Flutter-Release.xcconfig"
2 | #include "Warnings.xcconfig"
3 |
--------------------------------------------------------------------------------
/example/web/icons/Icon-192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunilDevX/flutter_thermal_printer/HEAD/example/web/icons/Icon-192.png
--------------------------------------------------------------------------------
/example/web/icons/Icon-512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunilDevX/flutter_thermal_printer/HEAD/example/web/icons/Icon-512.png
--------------------------------------------------------------------------------
/example/macos/.gitignore:
--------------------------------------------------------------------------------
1 | # Flutter-related
2 | **/Flutter/ephemeral/
3 | **/Pods/
4 |
5 | # Xcode-related
6 | **/dgph
7 | **/xcuserdata/
8 |
--------------------------------------------------------------------------------
/example/web/icons/Icon-maskable-192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunilDevX/flutter_thermal_printer/HEAD/example/web/icons/Icon-maskable-192.png
--------------------------------------------------------------------------------
/example/web/icons/Icon-maskable-512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunilDevX/flutter_thermal_printer/HEAD/example/web/icons/Icon-maskable-512.png
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunilDevX/flutter_thermal_printer/HEAD/android/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/example/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/example/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/example/windows/runner/resources/app_icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunilDevX/flutter_thermal_printer/HEAD/example/windows/runner/resources/app_icon.ico
--------------------------------------------------------------------------------
/android/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .cxx
10 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunilDevX/flutter_thermal_printer/HEAD/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunilDevX/flutter_thermal_printer/HEAD/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunilDevX/flutter_thermal_printer/HEAD/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunilDevX/flutter_thermal_printer/HEAD/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunilDevX/flutter_thermal_printer/HEAD/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunilDevX/flutter_thermal_printer/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunilDevX/flutter_thermal_printer/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunilDevX/flutter_thermal_printer/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunilDevX/flutter_thermal_printer/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunilDevX/flutter_thermal_printer/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunilDevX/flutter_thermal_printer/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunilDevX/flutter_thermal_printer/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunilDevX/flutter_thermal_printer/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunilDevX/flutter_thermal_printer/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunilDevX/flutter_thermal_printer/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunilDevX/flutter_thermal_printer/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunilDevX/flutter_thermal_printer/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunilDevX/flutter_thermal_printer/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunilDevX/flutter_thermal_printer/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunilDevX/flutter_thermal_printer/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunilDevX/flutter_thermal_printer/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunilDevX/flutter_thermal_printer/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunilDevX/flutter_thermal_printer/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunilDevX/flutter_thermal_printer/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunilDevX/flutter_thermal_printer/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunilDevX/flutter_thermal_printer/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunilDevX/flutter_thermal_printer/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunilDevX/flutter_thermal_printer/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunilDevX/flutter_thermal_printer/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SunilDevX/flutter_thermal_printer/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
--------------------------------------------------------------------------------
/example/linux/main.cc:
--------------------------------------------------------------------------------
1 | #include "my_application.h"
2 |
3 | int main(int argc, char** argv) {
4 | g_autoptr(MyApplication) app = my_application_new();
5 | return g_application_run(G_APPLICATION(app), argc, argv);
6 | }
7 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/android/app/src/main/kotlin/com/example/flutter_thermal_printer_example/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.example.flutter_thermal_printer_example
2 |
3 | import io.flutter.embedding.android.FlutterActivity
4 |
5 | class MainActivity: FlutterActivity() {
6 | }
7 |
--------------------------------------------------------------------------------
/example/linux/flutter/generated_plugin_registrant.cc:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | // clang-format off
6 |
7 | #include "generated_plugin_registrant.h"
8 |
9 |
10 | void fl_register_plugins(FlPluginRegistry* registry) {
11 | }
12 |
--------------------------------------------------------------------------------
/example/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | zipStoreBase=GRADLE_USER_HOME
4 | zipStorePath=wrapper/dists
5 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
6 |
--------------------------------------------------------------------------------
/example/android/app/src/main/java/com/example/flutter_thermal_printer_example/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.flutter_thermal_printer_example;
2 |
3 | import io.flutter.embedding.android.FlutterActivity;
4 |
5 | public class MainActivity extends FlutterActivity {
6 | }
7 |
--------------------------------------------------------------------------------
/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 | networkTimeout=10000
5 | zipStoreBase=GRADLE_USER_HOME
6 | zipStorePath=wrapper/dists
7 |
--------------------------------------------------------------------------------
/lib/Windows/windows_platform.dart:
--------------------------------------------------------------------------------
1 | // Windows-specific printer functionality
2 | // This file re-exports Windows printer classes and constants
3 |
4 | export 'package:ffi/ffi.dart' show using;
5 | export 'package:win32/win32.dart' show PRINTER_ENUM_LOCAL;
6 |
7 | export 'print_data.dart';
8 | export 'printers_data.dart';
9 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/macos/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/android/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/windows/.gitignore:
--------------------------------------------------------------------------------
1 | flutter/
2 |
3 | # Visual Studio user-specific files.
4 | *.suo
5 | *.user
6 | *.userosscache
7 | *.sln.docstates
8 |
9 | # Visual Studio build-related files.
10 | x64/
11 | x86/
12 |
13 | # Visual Studio cache files
14 | # files ending in .cache can be ignored
15 | *.[Cc]ache
16 | # but keep track of directories ending in .cache
17 | !*.[Cc]ache/
18 |
--------------------------------------------------------------------------------
/example/android/.gitignore:
--------------------------------------------------------------------------------
1 | gradle-wrapper.jar
2 | /.gradle
3 | /captures/
4 | /gradlew
5 | /gradlew.bat
6 | /local.properties
7 | GeneratedPluginRegistrant.java
8 |
9 | # Remember to never publicly share your keystore.
10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
11 | key.properties
12 | **/*.keystore
13 | **/*.jks
14 | app/.cxx
15 |
--------------------------------------------------------------------------------
/example/macos/RunnerTests/RunnerTests.swift:
--------------------------------------------------------------------------------
1 | import FlutterMacOS
2 | import Cocoa
3 | import XCTest
4 |
5 | class RunnerTests: XCTestCase {
6 |
7 | func testExample() {
8 | // If you add code to the Runner application, consider adding tests here.
9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest.
10 | }
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/example/windows/.gitignore:
--------------------------------------------------------------------------------
1 | flutter/ephemeral/
2 |
3 | # Visual Studio user-specific files.
4 | *.suo
5 | *.user
6 | *.userosscache
7 | *.sln.docstates
8 |
9 | # Visual Studio build-related files.
10 | x64/
11 | x86/
12 |
13 | # Visual Studio cache files
14 | # files ending in .cache can be ignored
15 | *.[Cc]ache
16 | # but keep track of directories ending in .cache
17 | !*.[Cc]ache/
18 |
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md:
--------------------------------------------------------------------------------
1 | # Launch Screen Assets
2 |
3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory.
4 |
5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
--------------------------------------------------------------------------------
/example/macos/Runner/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | import Cocoa
2 | import FlutterMacOS
3 |
4 | @main
5 | class AppDelegate: FlutterAppDelegate {
6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
7 | return true
8 | }
9 |
10 | override func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool {
11 | return true
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/example/linux/flutter/generated_plugin_registrant.h:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | // clang-format off
6 |
7 | #ifndef GENERATED_PLUGIN_REGISTRANT_
8 | #define GENERATED_PLUGIN_REGISTRANT_
9 |
10 | #include
11 |
12 | // Registers Flutter plugins.
13 | void fl_register_plugins(FlPluginRegistry* registry);
14 |
15 | #endif // GENERATED_PLUGIN_REGISTRANT_
16 |
--------------------------------------------------------------------------------
/example/windows/flutter/generated_plugin_registrant.h:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | // clang-format off
6 |
7 | #ifndef GENERATED_PLUGIN_REGISTRANT_
8 | #define GENERATED_PLUGIN_REGISTRANT_
9 |
10 | #include
11 |
12 | // Registers Flutter plugins.
13 | void RegisterPlugins(flutter::PluginRegistry* registry);
14 |
15 | #endif // GENERATED_PLUGIN_REGISTRANT_
16 |
--------------------------------------------------------------------------------
/example/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/android/app/src/profile/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/ios/Runner/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 | import Flutter
3 |
4 | @main
5 | @objc class AppDelegate: FlutterAppDelegate {
6 | override func application(
7 | _ application: UIApplication,
8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
9 | ) -> Bool {
10 | GeneratedPluginRegistrant.register(with: self)
11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions)
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/example/macos/Runner/MainFlutterWindow.swift:
--------------------------------------------------------------------------------
1 | import Cocoa
2 | import FlutterMacOS
3 |
4 | class MainFlutterWindow: NSWindow {
5 | override func awakeFromNib() {
6 | let flutterViewController = FlutterViewController()
7 | let windowFrame = self.frame
8 | self.contentViewController = flutterViewController
9 | self.setFrame(windowFrame, display: true)
10 |
11 | RegisterGeneratedPlugins(registry: flutterViewController)
12 |
13 | super.awakeFromNib()
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/example/linux/my_application.h:
--------------------------------------------------------------------------------
1 | #ifndef FLUTTER_MY_APPLICATION_H_
2 | #define FLUTTER_MY_APPLICATION_H_
3 |
4 | #include
5 |
6 | G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION,
7 | GtkApplication)
8 |
9 | /**
10 | * my_application_new:
11 | *
12 | * Creates a new Flutter-based application.
13 | *
14 | * Returns: a new #MyApplication.
15 | */
16 | MyApplication* my_application_new();
17 |
18 | #endif // FLUTTER_MY_APPLICATION_H_
19 |
--------------------------------------------------------------------------------
/example/macos/Flutter/GeneratedPluginRegistrant.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | import FlutterMacOS
6 | import Foundation
7 |
8 | import flutter_thermal_printer
9 | import universal_ble
10 |
11 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
12 | FlutterThermalPrinterPlugin.register(with: registry.registrar(forPlugin: "FlutterThermalPrinterPlugin"))
13 | UniversalBlePlugin.register(with: registry.registrar(forPlugin: "UniversalBlePlugin"))
14 | }
15 |
--------------------------------------------------------------------------------
/example/windows/runner/resource.h:
--------------------------------------------------------------------------------
1 | //{{NO_DEPENDENCIES}}
2 | // Microsoft Visual C++ generated include file.
3 | // Used by Runner.rc
4 | //
5 | #define IDI_APP_ICON 101
6 |
7 | // Next default values for new objects
8 | //
9 | #ifdef APSTUDIO_INVOKED
10 | #ifndef APSTUDIO_READONLY_SYMBOLS
11 | #define _APS_NEXT_RESOURCE_VALUE 102
12 | #define _APS_NEXT_COMMAND_VALUE 40001
13 | #define _APS_NEXT_CONTROL_VALUE 1001
14 | #define _APS_NEXT_SYMED_VALUE 101
15 | #endif
16 | #endif
17 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable-v21/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "LaunchImage.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "filename" : "LaunchImage@2x.png",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "universal",
15 | "filename" : "LaunchImage@3x.png",
16 | "scale" : "3x"
17 | }
18 | ],
19 | "info" : {
20 | "version" : 1,
21 | "author" : "xcode"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/windows/flutter_thermal_printer_plugin_c_api.cpp:
--------------------------------------------------------------------------------
1 | #include "include/flutter_thermal_printer/flutter_thermal_printer_plugin_c_api.h"
2 |
3 | #include
4 |
5 | #include "flutter_thermal_printer_plugin.h"
6 |
7 | void FlutterThermalPrinterPluginCApiRegisterWithRegistrar(
8 | FlutterDesktopPluginRegistrarRef registrar) {
9 | flutter_thermal_printer::FlutterThermalPrinterPlugin::RegisterWithRegistrar(
10 | flutter::PluginRegistrarManager::GetInstance()
11 | ->GetRegistrar(registrar));
12 | }
13 |
--------------------------------------------------------------------------------
/example/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 |
3 | repositories {
4 | google()
5 | mavenCentral()
6 | }
7 |
8 | dependencies {
9 | }
10 | }
11 |
12 | allprojects {
13 | repositories {
14 | google()
15 | mavenCentral()
16 | }
17 | }
18 |
19 | rootProject.buildDir = '../build'
20 | subprojects {
21 | project.buildDir = "${rootProject.buildDir}/${project.name}"
22 | }
23 | subprojects {
24 | project.evaluationDependsOn(':app')
25 | }
26 |
27 | tasks.register("clean", Delete) {
28 | delete rootProject.buildDir
29 | }
30 |
--------------------------------------------------------------------------------
/ios/.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/ephemeral/
38 | /Flutter/flutter_export_environment.sh
--------------------------------------------------------------------------------
/lib/utils/ble_config.dart:
--------------------------------------------------------------------------------
1 | class BleConfig {
2 | const BleConfig({
3 | this.connectionStabilizationDelay = const Duration(seconds: 10),
4 | });
5 |
6 | final Duration connectionStabilizationDelay;
7 |
8 | BleConfig copyWith({
9 | Duration? connectionStabilizationDelay,
10 | }) =>
11 | BleConfig(
12 | connectionStabilizationDelay:
13 | connectionStabilizationDelay ?? this.connectionStabilizationDelay,
14 | );
15 |
16 | @override
17 | String toString() =>
18 | 'BleConfig(connectionStabilizationDelay: $connectionStabilizationDelay)';
19 | }
20 |
--------------------------------------------------------------------------------
/example/macos/Runner/Release.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.security.app-sandbox
6 |
7 | com.apple.security.device.bluetooth
8 |
9 | com.apple.security.device.usb
10 |
11 | com.apple.security.network.client
12 |
13 | com.apple.security.network.server
14 |
15 | com.apple.security.print
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/example/integration_test/plugin_integration_test.dart:
--------------------------------------------------------------------------------
1 | // This is a basic Flutter integration test.
2 | //
3 | // Since integration tests run in a full Flutter application, they can interact
4 | // with the host side of a plugin implementation, unlike Dart unit tests.
5 | //
6 | // For more information about Flutter integration tests, please see
7 | // https://docs.flutter.dev/cookbook/testing/integration/introduction
8 |
9 | import 'package:flutter_test/flutter_test.dart';
10 | import 'package:integration_test/integration_test.dart';
11 |
12 | void main() {
13 | IntegrationTestWidgetsFlutterBinding.ensureInitialized();
14 | expect(true, true);
15 | }
16 |
--------------------------------------------------------------------------------
/example/windows/flutter/generated_plugin_registrant.cc:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | // clang-format off
6 |
7 | #include "generated_plugin_registrant.h"
8 |
9 | #include
10 | #include
11 |
12 | void RegisterPlugins(flutter::PluginRegistry* registry) {
13 | FlutterThermalPrinterPluginCApiRegisterWithRegistrar(
14 | registry->GetRegistrarForPlugin("FlutterThermalPrinterPluginCApi"));
15 | UniversalBlePluginCApiRegisterWithRegistrar(
16 | registry->GetRegistrarForPlugin("UniversalBlePluginCApi"));
17 | }
18 |
--------------------------------------------------------------------------------
/.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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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.device.bluetooth
10 |
11 | com.apple.security.device.usb
12 |
13 | com.apple.security.network.client
14 |
15 | com.apple.security.network.server
16 |
17 | com.apple.security.print
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/example/README.md:
--------------------------------------------------------------------------------
1 | # flutter_thermal_printer_example
2 |
3 | Demonstrates how to use the flutter_thermal_printer 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 |
--------------------------------------------------------------------------------
/example/macos/Runner/Configs/AppInfo.xcconfig:
--------------------------------------------------------------------------------
1 | // Application-level settings for the Runner target.
2 | //
3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the
4 | // future. If not, the values below would default to using the project name when this becomes a
5 | // 'flutter create' template.
6 |
7 | // The application's name. By default this is also the title of the Flutter window.
8 | PRODUCT_NAME = example
9 |
10 | // The application's bundle identifier
11 | PRODUCT_BUNDLE_IDENTIFIER = com.example.example
12 |
13 | // The copyright displayed in application information
14 | PRODUCT_COPYRIGHT = Copyright © 2024 com.example. All rights reserved.
15 |
--------------------------------------------------------------------------------
/example/ios/.gitignore:
--------------------------------------------------------------------------------
1 | **/dgph
2 | *.mode1v3
3 | *.mode2v3
4 | *.moved-aside
5 | *.pbxuser
6 | *.perspectivev3
7 | **/*sync/
8 | .sconsign.dblite
9 | .tags*
10 | **/.vagrant/
11 | **/DerivedData/
12 | Icon?
13 | **/Pods/
14 | **/.symlinks/
15 | profile
16 | xcuserdata
17 | **/.generated/
18 | Flutter/App.framework
19 | Flutter/Flutter.framework
20 | Flutter/Flutter.podspec
21 | Flutter/Generated.xcconfig
22 | Flutter/ephemeral/
23 | Flutter/app.flx
24 | Flutter/app.zip
25 | Flutter/flutter_assets/
26 | Flutter/flutter_export_environment.sh
27 | ServiceDefinitions.json
28 | Runner/GeneratedPluginRegistrant.*
29 |
30 | # Exceptions to above rules.
31 | !default.mode1v3
32 | !default.mode2v3
33 | !default.pbxuser
34 | !default.perspectivev3
35 |
--------------------------------------------------------------------------------
/example/windows/runner/utils.h:
--------------------------------------------------------------------------------
1 | #ifndef RUNNER_UTILS_H_
2 | #define RUNNER_UTILS_H_
3 |
4 | #include
5 | #include
6 |
7 | // Creates a console for the process, and redirects stdout and stderr to
8 | // it for both the runner and the Flutter library.
9 | void CreateAndAttachConsole();
10 |
11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string
12 | // encoded in UTF-8. Returns an empty std::string on failure.
13 | std::string Utf8FromUtf16(const wchar_t* utf16_string);
14 |
15 | // Gets the command line arguments passed in as a std::vector,
16 | // encoded in UTF-8. Returns an empty std::vector on failure.
17 | std::vector GetCommandLineArguments();
18 |
19 | #endif // RUNNER_UTILS_H_
20 |
--------------------------------------------------------------------------------
/windows/include/flutter_thermal_printer/flutter_thermal_printer_plugin_c_api.h:
--------------------------------------------------------------------------------
1 | #ifndef FLUTTER_PLUGIN_FLUTTER_THERMAL_PRINTER_PLUGIN_C_API_H_
2 | #define FLUTTER_PLUGIN_FLUTTER_THERMAL_PRINTER_PLUGIN_C_API_H_
3 |
4 | #include
5 |
6 | #ifdef FLUTTER_PLUGIN_IMPL
7 | #define FLUTTER_PLUGIN_EXPORT __declspec(dllexport)
8 | #else
9 | #define FLUTTER_PLUGIN_EXPORT __declspec(dllimport)
10 | #endif
11 |
12 | #if defined(__cplusplus)
13 | extern "C" {
14 | #endif
15 |
16 | FLUTTER_PLUGIN_EXPORT void FlutterThermalPrinterPluginCApiRegisterWithRegistrar(
17 | FlutterDesktopPluginRegistrarRef registrar);
18 |
19 | #if defined(__cplusplus)
20 | } // extern "C"
21 | #endif
22 |
23 | #endif // FLUTTER_PLUGIN_FLUTTER_THERMAL_PRINTER_PLUGIN_C_API_H_
24 |
--------------------------------------------------------------------------------
/ios/Classes/FlutterThermalPrinterPlugin.swift:
--------------------------------------------------------------------------------
1 | import Flutter
2 | import UIKit
3 |
4 | public class FlutterThermalPrinterPlugin: NSObject, FlutterPlugin {
5 | public static func register(with registrar: FlutterPluginRegistrar) {
6 | let channel = FlutterMethodChannel(name: "flutter_thermal_printer", binaryMessenger: registrar.messenger())
7 | let instance = FlutterThermalPrinterPlugin()
8 | registrar.addMethodCallDelegate(instance, channel: channel)
9 | }
10 |
11 | public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
12 | switch call.method {
13 | case "getPlatformVersion":
14 | result("iOS " + UIDevice.current.systemVersion)
15 | default:
16 | result(FlutterMethodNotImplemented)
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/.vscode/tasks.json:
--------------------------------------------------------------------------------
1 | {
2 | "tasks": [
3 | {
4 | "type": "cppbuild",
5 | "label": "C/C++: cl.exe build active file",
6 | "command": "cl.exe",
7 | "args": [
8 | "/Zi",
9 | "/EHsc",
10 | "/nologo",
11 | "/Fe${fileDirname}\\${fileBasenameNoExtension}.exe",
12 | "${file}"
13 | ],
14 | "options": {
15 | "cwd": "${fileDirname}"
16 | },
17 | "problemMatcher": [
18 | "$msCompile"
19 | ],
20 | "group": {
21 | "kind": "build",
22 | "isDefault": true
23 | },
24 | "detail": "Task generated by Debugger."
25 | }
26 | ],
27 | "version": "2.0.0"
28 | }
--------------------------------------------------------------------------------
/.vscode/c_cpp_properties.json:
--------------------------------------------------------------------------------
1 | {
2 | "configurations": [
3 | {
4 | "name": "Win32",
5 | "includePath": [
6 | "${workspaceFolder}/**",
7 | "${workspaceFolder}/example/build/windows/x64/_deps/googletest-src/googletest/include/gtest",
8 | "${workspaceFolder}/example/build/windows/x64/_deps/googletest-src/googletest/include"
9 | ],
10 | "defines": [
11 | "_DEBUG",
12 | "UNICODE",
13 | "_UNICODE"
14 | ],
15 | "windowsSdkVersion": "10.0.22621.0",
16 | "compilerPath": "cl.exe",
17 | "cStandard": "c17",
18 | "cppStandard": "c++17",
19 | "intelliSenseMode": "windows-msvc-x64"
20 | }
21 | ],
22 | "version": 4
23 | }
--------------------------------------------------------------------------------
/example/linux/flutter/generated_plugins.cmake:
--------------------------------------------------------------------------------
1 | #
2 | # Generated file, do not edit.
3 | #
4 |
5 | list(APPEND FLUTTER_PLUGIN_LIST
6 | )
7 |
8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST
9 | )
10 |
11 | set(PLUGIN_BUNDLED_LIBRARIES)
12 |
13 | foreach(plugin ${FLUTTER_PLUGIN_LIST})
14 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin})
15 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
16 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $)
17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
18 | endforeach(plugin)
19 |
20 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
21 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin})
22 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
23 | endforeach(ffi_plugin)
24 |
--------------------------------------------------------------------------------
/example/ios/RunnerTests/RunnerTests.swift:
--------------------------------------------------------------------------------
1 | import Flutter
2 | import UIKit
3 | import XCTest
4 |
5 | @testable import flutter_thermal_printer
6 |
7 | // This demonstrates a simple unit test of the Swift portion of this plugin's implementation.
8 | //
9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest.
10 |
11 | class RunnerTests: XCTestCase {
12 |
13 | func testGetPlatformVersion() {
14 | let plugin = FlutterThermalPrinterPlugin()
15 |
16 | let call = FlutterMethodCall(methodName: "getPlatformVersion", arguments: [])
17 |
18 | let resultExpectation = expectation(description: "result block must be called.")
19 | plugin.handle(call) { result in
20 | XCTAssertEqual(result as! String, "iOS " + UIDevice.current.systemVersion)
21 | resultExpectation.fulfill()
22 | }
23 | waitForExpectations(timeout: 1)
24 | }
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/example/ios/Flutter/AppFrameworkInfo.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | App
9 | CFBundleIdentifier
10 | io.flutter.flutter.app
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | App
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1.0
23 | MinimumOSVersion
24 | 12.0
25 |
26 |
27 |
--------------------------------------------------------------------------------
/example/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .build/
9 | .buildlog/
10 | .history
11 | .svn/
12 | .swiftpm/
13 | migrate_working_dir/
14 |
15 | # IntelliJ related
16 | *.iml
17 | *.ipr
18 | *.iws
19 | .idea/
20 |
21 | # The .vscode folder contains launch configuration and tasks you configure in
22 | # VS Code which you may wish to be included in version control, so this line
23 | # is commented out by default.
24 | #.vscode/
25 |
26 | # Flutter/Dart/Pub related
27 | **/doc/api/
28 | **/ios/Flutter/.last_build_id
29 | .dart_tool/
30 | .flutter-plugins
31 | .flutter-plugins-dependencies
32 | .pub-cache/
33 | .pub/
34 | /build/
35 |
36 | # Symbolication related
37 | app.*.symbols
38 |
39 | # Obfuscation related
40 | app.*.map.json
41 |
42 | # Android Studio will place build artifacts here
43 | /android/app/debug
44 | /android/app/profile
45 | /android/app/release
46 |
--------------------------------------------------------------------------------
/example/windows/flutter/generated_plugins.cmake:
--------------------------------------------------------------------------------
1 | #
2 | # Generated file, do not edit.
3 | #
4 |
5 | list(APPEND FLUTTER_PLUGIN_LIST
6 | flutter_thermal_printer
7 | universal_ble
8 | )
9 |
10 | list(APPEND FLUTTER_FFI_PLUGIN_LIST
11 | )
12 |
13 | set(PLUGIN_BUNDLED_LIBRARIES)
14 |
15 | foreach(plugin ${FLUTTER_PLUGIN_LIST})
16 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin})
17 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $)
19 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
20 | endforeach(plugin)
21 |
22 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
23 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin})
24 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
25 | endforeach(ffi_plugin)
26 |
--------------------------------------------------------------------------------
/lib/Windows/windows_stub.dart:
--------------------------------------------------------------------------------
1 | // Stub implementation for non-Windows platforms
2 | // This file provides empty implementations for Windows-specific functionality
3 | // ignore_for_file: avoid_annotating_with_dynamic
4 |
5 | // Win32 constants stub
6 | // ignore: constant_identifier_names
7 | const int PRINTER_ENUM_LOCAL = 0x00000002;
8 |
9 | class PrinterNames {
10 | PrinterNames(int _);
11 |
12 | Iterable all() sync* {
13 | // No Windows printers available on non-Windows platforms
14 | }
15 | }
16 |
17 | class RawPrinter {
18 | RawPrinter(String _, __);
19 |
20 | void printEscPosWin32(List data) {
21 | throw UnsupportedError(
22 | 'Windows printing is not supported on this platform',
23 | );
24 | }
25 | }
26 |
27 | // Stub implementation for FFI's using function
28 | R using(R Function() computation) {
29 | throw UnsupportedError('FFI using function is not supported on web platform');
30 | }
31 |
--------------------------------------------------------------------------------
/test/flutter_thermal_printer_method_channel_test.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/services.dart';
2 | import 'package:flutter_test/flutter_test.dart';
3 | import 'package:flutter_thermal_printer/flutter_thermal_printer_method_channel.dart';
4 |
5 | void main() {
6 | TestWidgetsFlutterBinding.ensureInitialized();
7 |
8 | final platform = MethodChannelFlutterThermalPrinter();
9 | const channel = MethodChannel('flutter_thermal_printer');
10 |
11 | setUp(() {
12 | TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
13 | .setMockMethodCallHandler(
14 | channel,
15 | (methodCall) async => '42',
16 | );
17 | });
18 |
19 | tearDown(() {
20 | TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
21 | .setMockMethodCallHandler(channel, null);
22 | });
23 |
24 | test('getPlatformVersion', () async {
25 | expect(await platform.getPlatformVersion(), '42');
26 | });
27 | }
28 |
--------------------------------------------------------------------------------
/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 | settings.ext.flutterSdkPath = flutterSdkPath()
10 |
11 | includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle")
12 |
13 | repositories {
14 | google()
15 | mavenCentral()
16 | gradlePluginPortal()
17 | }
18 |
19 | plugins {
20 | id "dev.flutter.flutter-gradle-plugin" version "1.0.0" apply false
21 | }
22 | }
23 |
24 | plugins {
25 | id "dev.flutter.flutter-plugin-loader" version "1.0.0"
26 | id "com.android.application" version "7.3.0" apply false
27 | }
28 |
29 | include ":app"
30 |
--------------------------------------------------------------------------------
/macos/flutter_thermal_printer.podspec:
--------------------------------------------------------------------------------
1 | #
2 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html.
3 | # Run `pod lib lint flutter_thermal_printer.podspec` to validate before publishing.
4 | #
5 | Pod::Spec.new do |s|
6 | s.name = 'flutter_thermal_printer'
7 | s.version = '0.0.1'
8 | s.summary = 'A new Flutter project.'
9 | s.description = <<-DESC
10 | A new Flutter project.
11 | DESC
12 | s.homepage = 'http://example.com'
13 | s.license = { :file => '../LICENSE' }
14 | s.author = { 'Your Company' => 'email@example.com' }
15 |
16 | s.source = { :path => '.' }
17 | s.source_files = 'Classes/**/*'
18 | s.dependency 'FlutterMacOS'
19 | # s.dependency 'ORSSerialPort'
20 | # s.dependency 'USBDeviceSwift'
21 | s.platform = :osx, '10.14'
22 | s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
23 | s.swift_version = '5.0'
24 | end
25 |
--------------------------------------------------------------------------------
/example/windows/runner/runner.exe.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PerMonitorV2
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/ios/flutter_thermal_printer.podspec:
--------------------------------------------------------------------------------
1 | #
2 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html.
3 | # Run `pod lib lint flutter_thermal_printer.podspec` to validate before publishing.
4 | #
5 | Pod::Spec.new do |s|
6 | s.name = 'flutter_thermal_printer'
7 | s.version = '0.0.1'
8 | s.summary = 'A new Flutter project.'
9 | s.description = <<-DESC
10 | A new Flutter project.
11 | DESC
12 | s.homepage = 'http://example.com'
13 | s.license = { :file => '../LICENSE' }
14 | s.author = { 'Your Company' => 'email@example.com' }
15 | s.source = { :path => '.' }
16 | s.source_files = 'Classes/**/*'
17 | s.dependency 'Flutter'
18 | s.platform = :ios, '11.0'
19 |
20 | # Flutter.framework does not contain a i386 slice.
21 | s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' }
22 | s.swift_version = '5.0'
23 | end
24 |
--------------------------------------------------------------------------------
/example/macos/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - flutter_thermal_printer (0.0.1):
3 | - FlutterMacOS
4 | - FlutterMacOS (1.0.0)
5 | - universal_ble (0.0.1):
6 | - Flutter
7 | - FlutterMacOS
8 |
9 | DEPENDENCIES:
10 | - flutter_thermal_printer (from `Flutter/ephemeral/.symlinks/plugins/flutter_thermal_printer/macos`)
11 | - FlutterMacOS (from `Flutter/ephemeral`)
12 | - universal_ble (from `Flutter/ephemeral/.symlinks/plugins/universal_ble/darwin`)
13 |
14 | EXTERNAL SOURCES:
15 | flutter_thermal_printer:
16 | :path: Flutter/ephemeral/.symlinks/plugins/flutter_thermal_printer/macos
17 | FlutterMacOS:
18 | :path: Flutter/ephemeral
19 | universal_ble:
20 | :path: Flutter/ephemeral/.symlinks/plugins/universal_ble/darwin
21 |
22 | SPEC CHECKSUMS:
23 | flutter_thermal_printer: 89ad742652b32933223d893678c14cbd59579ed0
24 | FlutterMacOS: d0db08ddef1a9af05a5ec4b724367152bb0500b1
25 | universal_ble: cf52a7b3fd2e7c14d6d7262e9fdadb72ab6b88a6
26 |
27 | PODFILE CHECKSUM: 3c8ad955ec40fb62e263a45c008146ad22756f7a
28 |
29 | COCOAPODS: 1.16.2
30 |
--------------------------------------------------------------------------------
/example/test/widget_test.dart:
--------------------------------------------------------------------------------
1 | // This is a basic Flutter widget test.
2 | //
3 | // To perform an interaction with a widget in your test, use the WidgetTester
4 | // utility in the flutter_test package. For example, you can send tap and scroll
5 | // gestures. You can also use WidgetTester to find child widgets in the widget
6 | // tree, read text, and verify that the values of widget properties are correct.
7 |
8 | import 'package:flutter/material.dart';
9 | import 'package:flutter_test/flutter_test.dart';
10 |
11 | import 'package:flutter_thermal_printer_example/main.dart';
12 |
13 | void main() {
14 | testWidgets('Verify Platform version', (WidgetTester tester) async {
15 | // Build our app and trigger a frame.
16 | await tester.pumpWidget(const MyApp());
17 |
18 | // Verify that platform version is retrieved.
19 | expect(
20 | find.byWidgetPredicate(
21 | (Widget widget) => widget is Text &&
22 | widget.data!.startsWith('Running on:'),
23 | ),
24 | findsOneWidget,
25 | );
26 | });
27 | }
28 |
--------------------------------------------------------------------------------
/example/web/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "example",
3 | "short_name": "example",
4 | "start_url": ".",
5 | "display": "standalone",
6 | "background_color": "#0175C2",
7 | "theme_color": "#0175C2",
8 | "description": "A new Flutter project.",
9 | "orientation": "portrait-primary",
10 | "prefer_related_applications": false,
11 | "icons": [
12 | {
13 | "src": "icons/Icon-192.png",
14 | "sizes": "192x192",
15 | "type": "image/png"
16 | },
17 | {
18 | "src": "icons/Icon-512.png",
19 | "sizes": "512x512",
20 | "type": "image/png"
21 | },
22 | {
23 | "src": "icons/Icon-maskable-192.png",
24 | "sizes": "192x192",
25 | "type": "image/png",
26 | "purpose": "maskable"
27 | },
28 | {
29 | "src": "icons/Icon-maskable-512.png",
30 | "sizes": "512x512",
31 | "type": "image/png",
32 | "purpose": "maskable"
33 | }
34 | ]
35 | }
36 |
--------------------------------------------------------------------------------
/example/windows/runner/flutter_window.h:
--------------------------------------------------------------------------------
1 | #ifndef RUNNER_FLUTTER_WINDOW_H_
2 | #define RUNNER_FLUTTER_WINDOW_H_
3 |
4 | #include
5 | #include
6 |
7 | #include
8 |
9 | #include "win32_window.h"
10 |
11 | // A window that does nothing but host a Flutter view.
12 | class FlutterWindow : public Win32Window {
13 | public:
14 | // Creates a new FlutterWindow hosting a Flutter view running |project|.
15 | explicit FlutterWindow(const flutter::DartProject& project);
16 | virtual ~FlutterWindow();
17 |
18 | protected:
19 | // Win32Window:
20 | bool OnCreate() override;
21 | void OnDestroy() override;
22 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam,
23 | LPARAM const lparam) noexcept override;
24 |
25 | private:
26 | // The project to run.
27 | flutter::DartProject project_;
28 |
29 | // The Flutter instance hosted by this window.
30 | std::unique_ptr flutter_controller_;
31 | };
32 |
33 | #endif // RUNNER_FLUTTER_WINDOW_H_
34 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/values-night/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/windows/flutter_thermal_printer_plugin.h:
--------------------------------------------------------------------------------
1 | #ifndef FLUTTER_PLUGIN_FLUTTER_THERMAL_PRINTER_PLUGIN_H_
2 | #define FLUTTER_PLUGIN_FLUTTER_THERMAL_PRINTER_PLUGIN_H_
3 |
4 | #include
5 | #include
6 |
7 | #include
8 |
9 | namespace flutter_thermal_printer {
10 |
11 | class FlutterThermalPrinterPlugin : public flutter::Plugin {
12 | public:
13 | static void RegisterWithRegistrar(flutter::PluginRegistrarWindows *registrar);
14 |
15 | FlutterThermalPrinterPlugin();
16 |
17 | virtual ~FlutterThermalPrinterPlugin();
18 |
19 | // Disallow copy and assign.
20 | FlutterThermalPrinterPlugin(const FlutterThermalPrinterPlugin&) = delete;
21 | FlutterThermalPrinterPlugin& operator=(const FlutterThermalPrinterPlugin&) = delete;
22 |
23 | // Called when a method is called on this plugin's channel from Dart.
24 | void HandleMethodCall(
25 | const flutter::MethodCall &method_call,
26 | std::unique_ptr> result);
27 | };
28 |
29 | } // namespace flutter_thermal_printer
30 |
31 | #endif // FLUTTER_PLUGIN_FLUTTER_THERMAL_PRINTER_PLUGIN_H_
32 |
--------------------------------------------------------------------------------
/android/src/test/java/com/example/flutter_thermal_printer/FlutterThermalPrinterPluginTest.java:
--------------------------------------------------------------------------------
1 | package com.example.flutter_thermal_printer;
2 |
3 | import static org.mockito.Mockito.mock;
4 | import static org.mockito.Mockito.verify;
5 |
6 | import io.flutter.plugin.common.MethodCall;
7 | import io.flutter.plugin.common.MethodChannel;
8 | import org.junit.Test;
9 |
10 | /**
11 | * This demonstrates a simple unit test of the Java portion of this plugin's implementation.
12 | *
13 | * Once you have built the plugin's example app, you can run these tests from the command
14 | * line by running `./gradlew testDebugUnitTest` in the `example/android/` directory, or
15 | * you can run them directly from IDEs that support JUnit such as Android Studio.
16 | */
17 |
18 | public class FlutterThermalPrinterPluginTest {
19 | @Test
20 | public void onMethodCall_getPlatformVersion_returnsExpectedValue() {
21 | FlutterThermalPrinterPlugin plugin = new FlutterThermalPrinterPlugin();
22 |
23 | final MethodCall call = new MethodCall("getPlatformVersion", null);
24 | MethodChannel.Result mockResult = mock(MethodChannel.Result.class);
25 | plugin.onMethodCall(call, mockResult);
26 |
27 | verify(mockResult).success("Android " + android.os.Build.VERSION.RELEASE);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/lib/network/network_print_result.dart:
--------------------------------------------------------------------------------
1 | class NetworkPrintResult {
2 | const NetworkPrintResult._internal(this.value);
3 | final int value;
4 | static const success = NetworkPrintResult._internal(1);
5 | static const timeout = NetworkPrintResult._internal(2);
6 | static const printerConnected = NetworkPrintResult._internal(3);
7 | static const ticketEmpty = NetworkPrintResult._internal(4);
8 | static const printInProgress = NetworkPrintResult._internal(5);
9 | static const scanInProgress = NetworkPrintResult._internal(6);
10 |
11 | String get msg {
12 | if (value == NetworkPrintResult.success.value) {
13 | return 'Success';
14 | } else if (value == NetworkPrintResult.timeout.value) {
15 | return 'Error. Printer connection timeout';
16 | } else if (value == NetworkPrintResult.printerConnected.value) {
17 | return 'Error. Printer not connected';
18 | } else if (value == NetworkPrintResult.ticketEmpty.value) {
19 | return 'Error. Ticket is empty';
20 | } else if (value == NetworkPrintResult.printInProgress.value) {
21 | return 'Error. Another print in progress';
22 | } else if (value == NetworkPrintResult.scanInProgress.value) {
23 | return 'Error. Printer scanning in progress';
24 | } else {
25 | return 'Unknown error';
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | group 'com.example.flutter_thermal_printer'
2 | version '1.0'
3 |
4 | buildscript {
5 | repositories {
6 | google()
7 | mavenCentral()
8 |
9 | }
10 |
11 | dependencies {
12 | classpath 'com.android.tools.build:gradle:7.3.0'
13 |
14 | }
15 | }
16 |
17 | rootProject.allprojects {
18 | repositories {
19 | google()
20 | mavenCentral()
21 | }
22 | }
23 |
24 | apply plugin: 'com.android.library'
25 |
26 | android {
27 | if (project.android.hasProperty("namespace")) {
28 | namespace 'com.example.flutter_thermal_printer'
29 | }
30 |
31 | compileSdkVersion 36
32 |
33 | compileOptions {
34 | sourceCompatibility JavaVersion.VERSION_1_8
35 | targetCompatibility JavaVersion.VERSION_1_8
36 | }
37 |
38 | defaultConfig {
39 | minSdkVersion 19
40 | }
41 |
42 | dependencies {
43 | testImplementation 'junit:junit:4.13.2'
44 | testImplementation 'org.mockito:mockito-core:5.0.0'
45 | }
46 |
47 | testOptions {
48 | unitTests.all {
49 | testLogging {
50 | events "passed", "skipped", "failed", "standardOut", "standardError"
51 | outputs.upToDateWhen {false}
52 | showStandardStreams = true
53 | }
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/windows/test/flutter_thermal_printer_plugin_test.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 | #include
6 |
7 | #include
8 | #include
9 | #include
10 |
11 | #include "flutter_thermal_printer_plugin.h"
12 |
13 | namespace flutter_thermal_printer {
14 | namespace test {
15 |
16 | namespace {
17 |
18 | using flutter::EncodableMap;
19 | using flutter::EncodableValue;
20 | using flutter::MethodCall;
21 | using flutter::MethodResultFunctions;
22 |
23 | } // namespace
24 |
25 | TEST(FlutterThermalPrinterPlugin, GetPlatformVersion) {
26 | FlutterThermalPrinterPlugin plugin;
27 | // Save the reply value from the success callback.
28 | std::string result_string;
29 | plugin.HandleMethodCall(
30 | MethodCall("getPlatformVersion", std::make_unique()),
31 | std::make_unique>(
32 | [&result_string](const EncodableValue* result) {
33 | result_string = std::get(*result);
34 | },
35 | nullptr, nullptr));
36 |
37 | // Since the exact string varies by host, just ensure that it's a string
38 | // with the expected format.
39 | EXPECT_TRUE(result_string.rfind("Windows ", 0) == 0);
40 | }
41 |
42 | } // namespace test
43 | } // namespace flutter_thermal_printer
44 |
--------------------------------------------------------------------------------
/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | // Use IntelliSense to learn about possible attributes.
3 | // Hover to view descriptions of existing attributes.
4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5 | "version": "0.2.0",
6 | "configurations": [
7 | {
8 | "name": "flutter_thermal_printer",
9 | "request": "launch",
10 | "type": "dart"
11 | },
12 | {
13 | "name": "flutter_thermal_printer (profile mode)",
14 | "request": "launch",
15 | "type": "dart",
16 | "flutterMode": "profile"
17 | },
18 | {
19 | "name": "flutter_thermal_printer (release mode)",
20 | "request": "launch",
21 | "type": "dart",
22 | "flutterMode": "release"
23 | },
24 | {
25 | "name": "example",
26 | "cwd": "example",
27 | "request": "launch",
28 | "type": "dart"
29 | },
30 | {
31 | "name": "example (profile mode)",
32 | "cwd": "example",
33 | "request": "launch",
34 | "type": "dart",
35 | "flutterMode": "profile"
36 | },
37 | {
38 | "name": "example (release mode)",
39 | "cwd": "example",
40 | "request": "launch",
41 | "type": "dart",
42 | "flutterMode": "release"
43 | }
44 | ]
45 | }
--------------------------------------------------------------------------------
/example/windows/runner/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | #include "flutter_window.h"
6 | #include "utils.h"
7 |
8 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
9 | _In_ wchar_t *command_line, _In_ int show_command) {
10 | // Attach to console when present (e.g., 'flutter run') or create a
11 | // new console when running with a debugger.
12 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) {
13 | CreateAndAttachConsole();
14 | }
15 |
16 | // Initialize COM, so that it is available for use in the library and/or
17 | // plugins.
18 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
19 |
20 | flutter::DartProject project(L"data");
21 |
22 | std::vector command_line_arguments =
23 | GetCommandLineArguments();
24 |
25 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments));
26 |
27 | FlutterWindow window(project);
28 | Win32Window::Point origin(10, 10);
29 | Win32Window::Size size(1280, 720);
30 | if (!window.Create(L"flutter_thermal_printer_example", origin, size)) {
31 | return EXIT_FAILURE;
32 | }
33 | window.SetQuitOnClose(true);
34 |
35 | ::MSG msg;
36 | while (::GetMessage(&msg, nullptr, 0, 0)) {
37 | ::TranslateMessage(&msg);
38 | ::DispatchMessage(&msg);
39 | }
40 |
41 | ::CoUninitialize();
42 | return EXIT_SUCCESS;
43 | }
44 |
--------------------------------------------------------------------------------
/example/macos/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDisplayName
6 |
7 | LSApplicationCategoryType
8 |
9 | NSCameraPortraitEffectEnabled
10 |
11 | CFBundleDevelopmentRegion
12 | $(DEVELOPMENT_LANGUAGE)
13 | CFBundleExecutable
14 | $(EXECUTABLE_NAME)
15 | CFBundleIconFile
16 |
17 | CFBundleIdentifier
18 | $(PRODUCT_BUNDLE_IDENTIFIER)
19 | CFBundleInfoDictionaryVersion
20 | 6.0
21 | CFBundleName
22 | $(PRODUCT_NAME)
23 | CFBundlePackageType
24 | APPL
25 | CFBundleShortVersionString
26 | $(FLUTTER_BUILD_NAME)
27 | CFBundleVersion
28 | $(FLUTTER_BUILD_NUMBER)
29 | LSMinimumSystemVersion
30 | $(MACOSX_DEPLOYMENT_TARGET)
31 | NSHumanReadableCopyright
32 | $(PRODUCT_COPYRIGHT)
33 | NSMainNibFile
34 | MainMenu
35 | NSPrincipalClass
36 | NSApplication
37 | NSBluetoothAlwaysUsageDescription
38 | For printer scanner
39 |
40 |
41 |
--------------------------------------------------------------------------------
/example/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | # This file configures the analyzer, which statically analyzes Dart code to
2 | # check for errors, warnings, and lints.
3 | #
4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled
5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
6 | # invoked from the command line by running `flutter analyze`.
7 |
8 | # The following line activates a set of recommended lints for Flutter apps,
9 | # packages, and plugins designed to encourage good coding practices.
10 | include: package:flutter_lints/flutter.yaml
11 |
12 | linter:
13 | # The lint rules applied to this project can be customized in the
14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml`
15 | # included above or to enable additional rules. A list of all available lints
16 | # and their documentation is published at https://dart.dev/lints.
17 | #
18 | # Instead of disabling a lint rule for the entire project in the
19 | # section below, it can also be suppressed for a single line of code
20 | # or a specific dart file by using the `// ignore: name_of_lint` and
21 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file
22 | # producing the lint.
23 | rules:
24 | # avoid_print: false # Uncomment to disable the `avoid_print` rule
25 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
26 |
27 | # Additional information about this file can be found at
28 | # https://dart.dev/guides/language/analysis-options
29 |
--------------------------------------------------------------------------------
/example/ios/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - Flutter (1.0.0)
3 | - flutter_blue_plus (0.0.1):
4 | - Flutter
5 | - flutter_thermal_printer (0.0.1):
6 | - Flutter
7 | - integration_test (0.0.1):
8 | - Flutter
9 | - path_provider_foundation (0.0.1):
10 | - Flutter
11 | - FlutterMacOS
12 |
13 | DEPENDENCIES:
14 | - Flutter (from `Flutter`)
15 | - flutter_blue_plus (from `.symlinks/plugins/flutter_blue_plus/ios`)
16 | - flutter_thermal_printer (from `.symlinks/plugins/flutter_thermal_printer/ios`)
17 | - integration_test (from `.symlinks/plugins/integration_test/ios`)
18 | - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
19 |
20 | EXTERNAL SOURCES:
21 | Flutter:
22 | :path: Flutter
23 | flutter_blue_plus:
24 | :path: ".symlinks/plugins/flutter_blue_plus/ios"
25 | flutter_thermal_printer:
26 | :path: ".symlinks/plugins/flutter_thermal_printer/ios"
27 | integration_test:
28 | :path: ".symlinks/plugins/integration_test/ios"
29 | path_provider_foundation:
30 | :path: ".symlinks/plugins/path_provider_foundation/darwin"
31 |
32 | SPEC CHECKSUMS:
33 | Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
34 | flutter_blue_plus: 4837da7d00cf5d441fdd6635b3a57f936778ea96
35 | flutter_thermal_printer: b8d6327b4d50d4d810a7568188692d0db882c3e6
36 | integration_test: 252f60fa39af5e17c3aa9899d35d908a0721b573
37 | path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
38 |
39 | PODFILE CHECKSUM: 7be435dfd2f26876bfa5e0357ac24dbb6d9646e7
40 |
41 | COCOAPODS: 1.16.2
42 |
--------------------------------------------------------------------------------
/.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: "78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9"
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: 78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9
17 | base_revision: 78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9
18 | - platform: android
19 | create_revision: 78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9
20 | base_revision: 78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9
21 | - platform: ios
22 | create_revision: 78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9
23 | base_revision: 78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9
24 | - platform: macos
25 | create_revision: 78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9
26 | base_revision: 78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9
27 | - platform: windows
28 | create_revision: 78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9
29 | base_revision: 78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9
30 |
31 | # User provided section
32 |
33 | # List of Local paths (relative to this file) that should be
34 | # ignored by the migrate tool.
35 | #
36 | # Files that are not part of the templates will be ignored by default.
37 | unmanaged_files:
38 | - 'lib/main.dart'
39 | - 'ios/Runner.xcodeproj/project.pbxproj'
40 |
--------------------------------------------------------------------------------
/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 | flutter_install_all_ios_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_ios_build_settings(target)
42 | end
43 | end
44 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Note: This license has also been called the “New BSD License” or “Modified BSD License”. See also the 2-clause BSD License.
2 |
3 | Copyright 2023 @sunilflutter.in
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 |
9 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
10 |
11 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
12 |
13 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
14 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/example/macos/Podfile:
--------------------------------------------------------------------------------
1 | platform :osx, '10.15'
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 | flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__))
33 | target 'RunnerTests' do
34 | inherit! :search_paths
35 | end
36 | end
37 |
38 | post_install do |installer|
39 | installer.pods_project.targets.each do |target|
40 | flutter_additional_macos_build_settings(target)
41 | target.build_configurations.each do |config|
42 | config.build_settings['MACOSX_DEPLOYMENT_TARGET'] = '10.14'
43 | end
44 | end
45 | end
46 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/lib/Windows/print_data.dart:
--------------------------------------------------------------------------------
1 | // Sends RAW data (string or hex sequences) directly to the printer
2 |
3 | // Example taken from:
4 | // https://learn.microsoft.com/windows/win32/printdocs/sending-data-directly-to-a-printer
5 |
6 | import 'dart:ffi';
7 | import 'dart:typed_data';
8 |
9 | import 'package:ffi/ffi.dart';
10 | import 'package:win32/win32.dart';
11 |
12 | class RawPrinter {
13 | RawPrinter(this.printerName, this.alloc);
14 | final String printerName;
15 | final Arena alloc;
16 |
17 | void printEscPosWin32(List data) {
18 | final hPrinter = calloc();
19 | final docInfo = calloc();
20 |
21 | final printerNamePtr = printerName.toNativeUtf16();
22 | final docNamePtr = 'ESC/POS Print Job'.toNativeUtf16();
23 |
24 | docInfo.ref.pDocName = docNamePtr;
25 | docInfo.ref.pOutputFile = nullptr;
26 | docInfo.ref.pDatatype = nullptr;
27 |
28 | if (OpenPrinter(printerNamePtr, hPrinter, nullptr) != 0) {
29 | final printerHandle = hPrinter.value;
30 |
31 | if (StartDocPrinter(printerHandle, 1, docInfo.cast()) != 0) {
32 | StartPagePrinter(printerHandle);
33 |
34 | final buffer = Uint8List.fromList(data);
35 | final bytesWritten = calloc();
36 |
37 | WritePrinter(
38 | printerHandle,
39 | buffer.allocatePointer(),
40 | buffer.length,
41 | bytesWritten,
42 | );
43 |
44 | EndPagePrinter(printerHandle);
45 | EndDocPrinter(printerHandle);
46 | }
47 |
48 | ClosePrinter(printerHandle);
49 | }
50 |
51 | calloc
52 | ..free(printerNamePtr)
53 | ..free(docNamePtr)
54 | ..free(hPrinter)
55 | ..free(docInfo);
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/xml/device_filter.xml:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/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: "78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9"
8 | channel: "stable"
9 |
10 | project_type: app
11 |
12 | # Tracks metadata for the flutter migrate command
13 | migration:
14 | platforms:
15 | - platform: root
16 | create_revision: 78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9
17 | base_revision: 78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9
18 | - platform: android
19 | create_revision: 78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9
20 | base_revision: 78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9
21 | - platform: ios
22 | create_revision: 78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9
23 | base_revision: 78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9
24 | - platform: linux
25 | create_revision: 78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9
26 | base_revision: 78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9
27 | - platform: macos
28 | create_revision: 78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9
29 | base_revision: 78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9
30 | - platform: web
31 | create_revision: 78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9
32 | base_revision: 78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9
33 | - platform: windows
34 | create_revision: 78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9
35 | base_revision: 78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9
36 |
37 | # User provided section
38 |
39 | # List of Local paths (relative to this file) that should be
40 | # ignored by the migrate tool.
41 | #
42 | # Files that are not part of the templates will be ignored by default.
43 | unmanaged_files:
44 | - 'lib/main.dart'
45 | - 'ios/Runner.xcodeproj/project.pbxproj'
46 |
--------------------------------------------------------------------------------
/example/ios/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleDisplayName
8 | Flutter Thermal Printer
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | flutter_thermal_printer_example
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | $(FLUTTER_BUILD_NAME)
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | $(FLUTTER_BUILD_NUMBER)
25 | LSRequiresIPhoneOS
26 |
27 | UILaunchStoryboardName
28 | LaunchScreen
29 | UIMainStoryboardFile
30 | Main
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 | UISupportedInterfaceOrientations~ipad
38 |
39 | UIInterfaceOrientationPortrait
40 | UIInterfaceOrientationPortraitUpsideDown
41 | UIInterfaceOrientationLandscapeLeft
42 | UIInterfaceOrientationLandscapeRight
43 |
44 | CADisableMinimumFrameDurationOnPhone
45 |
46 | UIApplicationSupportsIndirectInputEvents
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/example/windows/runner/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.14)
2 | project(runner LANGUAGES CXX)
3 |
4 | # Define the application target. To change its name, change BINARY_NAME in the
5 | # top-level CMakeLists.txt, not the value here, or `flutter run` will no longer
6 | # work.
7 | #
8 | # Any new source files that you add to the application should be added here.
9 | add_executable(${BINARY_NAME} WIN32
10 | "flutter_window.cpp"
11 | "main.cpp"
12 | "utils.cpp"
13 | "win32_window.cpp"
14 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
15 | "Runner.rc"
16 | "runner.exe.manifest"
17 | )
18 |
19 | # Apply the standard set of build settings. This can be removed for applications
20 | # that need different build settings.
21 | apply_standard_settings(${BINARY_NAME})
22 |
23 | # Add preprocessor definitions for the build version.
24 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"")
25 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}")
26 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}")
27 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}")
28 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}")
29 |
30 | # Disable Windows macros that collide with C++ standard library functions.
31 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX")
32 |
33 | # Add dependency libraries and include directories. Add any application-specific
34 | # dependencies here.
35 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app)
36 | target_link_libraries(${BINARY_NAME} PRIVATE "dwmapi.lib")
37 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}")
38 |
39 | # Run the Flutter tool portions of the build. This must not be removed.
40 | add_dependencies(${BINARY_NAME} flutter_assemble)
41 |
--------------------------------------------------------------------------------
/lib/Windows/printers_data.dart:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2020, Dart | Windows. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | // Enumerates locally-connected printers.
6 |
7 | import 'dart:ffi';
8 |
9 | import 'package:ffi/ffi.dart';
10 | import 'package:win32/win32.dart';
11 |
12 | class PrinterNames {
13 | PrinterNames(this._flags);
14 | final int _flags;
15 |
16 | Iterable all() sync* {
17 | try {
18 | _getBufferSize();
19 |
20 | try {
21 | _readRawBuff();
22 | yield* parse();
23 | } finally {
24 | free(_rawBuffer);
25 | }
26 | } finally {
27 | free(_pBuffSize);
28 | free(_bPrinterLen);
29 | }
30 | }
31 |
32 | late Pointer _pBuffSize;
33 | late Pointer _bPrinterLen;
34 |
35 | void _getBufferSize() {
36 | _pBuffSize = calloc();
37 | _bPrinterLen = calloc();
38 |
39 | EnumPrinters(_flags, nullptr, 2, nullptr, 0, _pBuffSize, _bPrinterLen);
40 |
41 | if (_pBuffSize.value == 0) {
42 | throw Exception('Read printer buffer size fail');
43 | }
44 | }
45 |
46 | late Pointer _rawBuffer;
47 |
48 | void _readRawBuff() {
49 | _rawBuffer = malloc.allocate(_pBuffSize.value);
50 |
51 | final isRawBuffFail = EnumPrinters(
52 | _flags,
53 | nullptr,
54 | 2,
55 | _rawBuffer,
56 | _pBuffSize.value,
57 | _pBuffSize,
58 | _bPrinterLen,
59 | ) ==
60 | 0;
61 |
62 | if (isRawBuffFail) {
63 | throw Exception('Read printer raw buffer fail');
64 | }
65 | }
66 |
67 | Iterable parse() sync* {
68 | for (var i = 0; i < _bPrinterLen.value; i++) {
69 | final printer = _rawBuffer.cast() + i;
70 | yield printer.ref.pPrinterName.toDartString();
71 | }
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/example/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id "com.android.application"
3 | id "dev.flutter.flutter-gradle-plugin"
4 | }
5 |
6 | def localProperties = new Properties()
7 | def localPropertiesFile = rootProject.file('local.properties')
8 | if (localPropertiesFile.exists()) {
9 | localPropertiesFile.withReader('UTF-8') { reader ->
10 | localProperties.load(reader)
11 | }
12 | }
13 |
14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15 | if (flutterVersionCode == null) {
16 | flutterVersionCode = '1'
17 | }
18 |
19 | def flutterVersionName = localProperties.getProperty('flutter.versionName')
20 | if (flutterVersionName == null) {
21 | flutterVersionName = '1.0'
22 | }
23 |
24 | android {
25 | namespace "com.example.flutter_thermal_printer_example"
26 | compileSdkVersion flutter.compileSdkVersion
27 | ndkVersion flutter.ndkVersion
28 |
29 | compileOptions {
30 | sourceCompatibility JavaVersion.VERSION_1_8
31 | targetCompatibility JavaVersion.VERSION_1_8
32 | }
33 |
34 | defaultConfig {
35 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
36 | applicationId "com.example.flutter_thermal_printer_example"
37 | // You can update the following values to match your application needs.
38 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
39 | minSdkVersion flutter.minSdkVersion
40 | targetSdkVersion flutter.targetSdkVersion
41 | versionCode flutterVersionCode.toInteger()
42 | versionName flutterVersionName
43 | }
44 |
45 |
46 | buildTypes {
47 | release {
48 | // TODO: Add your own signing config for the release build.
49 | // Signing with the debug keys for now, so `flutter run --release` works.
50 | signingConfig signingConfigs.debug
51 | }
52 | }
53 | }
54 |
55 | flutter {
56 | source '../..'
57 | }
58 |
--------------------------------------------------------------------------------
/lib/flutter_thermal_printer_platform_interface.dart:
--------------------------------------------------------------------------------
1 | import 'dart:typed_data';
2 |
3 | import 'package:plugin_platform_interface/plugin_platform_interface.dart';
4 |
5 | import 'flutter_thermal_printer_method_channel.dart';
6 | import 'utils/printer.dart';
7 |
8 | abstract class FlutterThermalPrinterPlatform extends PlatformInterface {
9 | FlutterThermalPrinterPlatform() : super(token: _token);
10 | static final Object _token = Object();
11 | static FlutterThermalPrinterPlatform _instance =
12 | MethodChannelFlutterThermalPrinter();
13 | static FlutterThermalPrinterPlatform get instance => _instance;
14 |
15 | static set instance(FlutterThermalPrinterPlatform instance) {
16 | PlatformInterface.verifyToken(instance, _token);
17 | _instance = instance;
18 | }
19 |
20 | Future getPlatformVersion() {
21 | throw UnimplementedError('platformVersion() has not been implemented.');
22 | }
23 |
24 | Future startUsbScan() {
25 | throw UnimplementedError('startScan() has not been implemented.');
26 | }
27 |
28 | Future connect(Printer device) {
29 | throw UnimplementedError('connect() has not been implemented.');
30 | }
31 |
32 | Future printText(Printer device, Uint8List data, {String? path}) {
33 | throw UnimplementedError('printText() has not been implemented.');
34 | }
35 |
36 | Future isConnected(Printer device) {
37 | throw UnimplementedError('isConnected() has not been implemented.');
38 | }
39 |
40 | Future convertImageToGrayscale(Uint8List? value) {
41 | throw UnimplementedError(
42 | 'convertImageToGrayscale() has not been implemented.',
43 | );
44 | }
45 |
46 | Future disconnect(Printer device) {
47 | throw UnimplementedError('disconnect() has not been implemented.');
48 | }
49 |
50 | Future stopScan() {
51 | throw UnimplementedError('stopScan() has not been implemented.');
52 | }
53 |
54 | Future getPrinters() {
55 | throw UnimplementedError('getPrinters() has not been implemented.');
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/example/windows/runner/utils.cpp:
--------------------------------------------------------------------------------
1 | #include "utils.h"
2 |
3 | #include
4 | #include
5 | #include
6 | #include
7 |
8 | #include
9 |
10 | void CreateAndAttachConsole() {
11 | if (::AllocConsole()) {
12 | FILE *unused;
13 | if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
14 | _dup2(_fileno(stdout), 1);
15 | }
16 | if (freopen_s(&unused, "CONOUT$", "w", stderr)) {
17 | _dup2(_fileno(stdout), 2);
18 | }
19 | std::ios::sync_with_stdio();
20 | FlutterDesktopResyncOutputStreams();
21 | }
22 | }
23 |
24 | std::vector GetCommandLineArguments() {
25 | // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use.
26 | int argc;
27 | wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc);
28 | if (argv == nullptr) {
29 | return std::vector();
30 | }
31 |
32 | std::vector command_line_arguments;
33 |
34 | // Skip the first argument as it's the binary name.
35 | for (int i = 1; i < argc; i++) {
36 | command_line_arguments.push_back(Utf8FromUtf16(argv[i]));
37 | }
38 |
39 | ::LocalFree(argv);
40 |
41 | return command_line_arguments;
42 | }
43 |
44 | std::string Utf8FromUtf16(const wchar_t* utf16_string) {
45 | if (utf16_string == nullptr) {
46 | return std::string();
47 | }
48 | int target_length = ::WideCharToMultiByte(
49 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string,
50 | -1, nullptr, 0, nullptr, nullptr)
51 | -1; // remove the trailing null character
52 | int input_length = (int)wcslen(utf16_string);
53 | std::string utf8_string;
54 | if (target_length <= 0 || target_length > utf8_string.max_size()) {
55 | return utf8_string;
56 | }
57 | utf8_string.resize(target_length);
58 | int converted_length = ::WideCharToMultiByte(
59 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string,
60 | input_length, utf8_string.data(), target_length, nullptr, nullptr);
61 | if (converted_length == 0) {
62 | return std::string();
63 | }
64 | return utf8_string;
65 | }
66 |
--------------------------------------------------------------------------------
/example/web/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | example
33 |
34 |
35 |
39 |
40 |
41 |
42 |
43 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/lib/flutter_thermal_printer_method_channel.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/foundation.dart';
2 | import 'package:flutter/services.dart';
3 |
4 | import 'flutter_thermal_printer_platform_interface.dart';
5 | import 'utils/printer.dart';
6 |
7 | /// An implementation of [FlutterThermalPrinterPlatform] that uses method channels.
8 | class MethodChannelFlutterThermalPrinter extends FlutterThermalPrinterPlatform {
9 | /// The method channel used to interact with the native platform.
10 | @visibleForTesting
11 | final methodChannel = const MethodChannel('flutter_thermal_printer');
12 |
13 | @override
14 | Future getPlatformVersion() async {
15 | final version =
16 | await methodChannel.invokeMethod('getPlatformVersion');
17 | return version;
18 | }
19 |
20 | @override
21 | Future startUsbScan() async =>
22 | methodChannel.invokeMethod('getUsbDevicesList');
23 |
24 | @override
25 | Future connect(Printer device) async =>
26 | await methodChannel.invokeMethod('connect', device.toJson());
27 |
28 | @override
29 | Future printText(
30 | Printer device,
31 | Uint8List data, {
32 | String? path,
33 | }) async =>
34 | await methodChannel.invokeMethod('printText', {
35 | 'vendorId': device.vendorId.toString(),
36 | 'productId': device.productId.toString(),
37 | 'name': device.name,
38 | 'data': List.from(data),
39 | 'path': path ?? '',
40 | });
41 |
42 | @override
43 | Future isConnected(Printer device) async =>
44 | await methodChannel.invokeMethod('isConnected', device.toJson());
45 |
46 | @override
47 | Future convertImageToGrayscale(Uint8List? value) async =>
48 | methodChannel.invokeMethod('convertimage', {
49 | 'path': List.from(value!),
50 | });
51 |
52 | @override
53 | Future disconnect(Printer device) async =>
54 | await methodChannel.invokeMethod('disconnect', {
55 | 'vendorId': device.vendorId.toString(),
56 | 'productId': device.productId.toString(),
57 | });
58 | }
59 |
--------------------------------------------------------------------------------
/windows/flutter_thermal_printer_plugin.cpp:
--------------------------------------------------------------------------------
1 | #include "flutter_thermal_printer_plugin.h"
2 |
3 | // This must be included before many other Windows headers.
4 | #include
5 |
6 | // For getPlatformVersion; remove unless needed for your plugin implementation.
7 | #include
8 |
9 | #include
10 | #include
11 | #include
12 |
13 | #include
14 | #include
15 |
16 | namespace flutter_thermal_printer {
17 |
18 | // static
19 | void FlutterThermalPrinterPlugin::RegisterWithRegistrar(
20 | flutter::PluginRegistrarWindows *registrar) {
21 | auto channel =
22 | std::make_unique>(
23 | registrar->messenger(), "flutter_thermal_printer",
24 | &flutter::StandardMethodCodec::GetInstance());
25 |
26 | auto plugin = std::make_unique();
27 |
28 | channel->SetMethodCallHandler(
29 | [plugin_pointer = plugin.get()](const auto &call, auto result) {
30 | plugin_pointer->HandleMethodCall(call, std::move(result));
31 | });
32 |
33 | registrar->AddPlugin(std::move(plugin));
34 | }
35 |
36 | FlutterThermalPrinterPlugin::FlutterThermalPrinterPlugin() {}
37 |
38 | FlutterThermalPrinterPlugin::~FlutterThermalPrinterPlugin() {}
39 |
40 | void FlutterThermalPrinterPlugin::HandleMethodCall(
41 | const flutter::MethodCall &method_call,
42 | std::unique_ptr> result) {
43 | if (method_call.method_name().compare("getPlatformVersion") == 0) {
44 | std::ostringstream version_stream;
45 | version_stream << "Windows ";
46 | if (IsWindows10OrGreater()) {
47 | version_stream << "10+";
48 | } else if (IsWindows8OrGreater()) {
49 | version_stream << "8";
50 | } else if (IsWindows7OrGreater()) {
51 | version_stream << "7";
52 | }
53 | result->Success(flutter::EncodableValue(version_stream.str()));
54 | } else {
55 | result->NotImplemented();
56 | }
57 | }
58 |
59 | } // namespace flutter_thermal_printer
60 |
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "cmake.configureOnOpen": true,
3 | "files.associations": {
4 | "xstring": "cpp",
5 | "algorithm": "cpp",
6 | "any": "cpp",
7 | "array": "cpp",
8 | "atomic": "cpp",
9 | "bit": "cpp",
10 | "cctype": "cpp",
11 | "charconv": "cpp",
12 | "chrono": "cpp",
13 | "clocale": "cpp",
14 | "cmath": "cpp",
15 | "compare": "cpp",
16 | "concepts": "cpp",
17 | "cstddef": "cpp",
18 | "cstdint": "cpp",
19 | "cstdio": "cpp",
20 | "cstdlib": "cpp",
21 | "cstring": "cpp",
22 | "ctime": "cpp",
23 | "cwchar": "cpp",
24 | "deque": "cpp",
25 | "exception": "cpp",
26 | "format": "cpp",
27 | "forward_list": "cpp",
28 | "fstream": "cpp",
29 | "functional": "cpp",
30 | "initializer_list": "cpp",
31 | "iomanip": "cpp",
32 | "ios": "cpp",
33 | "iosfwd": "cpp",
34 | "iostream": "cpp",
35 | "istream": "cpp",
36 | "iterator": "cpp",
37 | "limits": "cpp",
38 | "list": "cpp",
39 | "locale": "cpp",
40 | "map": "cpp",
41 | "memory": "cpp",
42 | "new": "cpp",
43 | "optional": "cpp",
44 | "ostream": "cpp",
45 | "ratio": "cpp",
46 | "set": "cpp",
47 | "sstream": "cpp",
48 | "stdexcept": "cpp",
49 | "streambuf": "cpp",
50 | "string": "cpp",
51 | "system_error": "cpp",
52 | "tuple": "cpp",
53 | "type_traits": "cpp",
54 | "typeinfo": "cpp",
55 | "unordered_map": "cpp",
56 | "unordered_set": "cpp",
57 | "utility": "cpp",
58 | "variant": "cpp",
59 | "vector": "cpp",
60 | "xfacet": "cpp",
61 | "xhash": "cpp",
62 | "xiosbase": "cpp",
63 | "xlocale": "cpp",
64 | "xlocbuf": "cpp",
65 | "xlocinfo": "cpp",
66 | "xlocmes": "cpp",
67 | "xlocmon": "cpp",
68 | "xlocnum": "cpp",
69 | "xloctime": "cpp",
70 | "xmemory": "cpp",
71 | "xtr1common": "cpp",
72 | "xtree": "cpp",
73 | "xutility": "cpp"
74 | },
75 | }
--------------------------------------------------------------------------------
/example/windows/runner/flutter_window.cpp:
--------------------------------------------------------------------------------
1 | #include "flutter_window.h"
2 |
3 | #include
4 |
5 | #include "flutter/generated_plugin_registrant.h"
6 |
7 | FlutterWindow::FlutterWindow(const flutter::DartProject& project)
8 | : project_(project) {}
9 |
10 | FlutterWindow::~FlutterWindow() {}
11 |
12 | bool FlutterWindow::OnCreate() {
13 | if (!Win32Window::OnCreate()) {
14 | return false;
15 | }
16 |
17 | RECT frame = GetClientArea();
18 |
19 | // The size here must match the window dimensions to avoid unnecessary surface
20 | // creation / destruction in the startup path.
21 | flutter_controller_ = std::make_unique(
22 | frame.right - frame.left, frame.bottom - frame.top, project_);
23 | // Ensure that basic setup of the controller was successful.
24 | if (!flutter_controller_->engine() || !flutter_controller_->view()) {
25 | return false;
26 | }
27 | RegisterPlugins(flutter_controller_->engine());
28 | SetChildContent(flutter_controller_->view()->GetNativeWindow());
29 |
30 | flutter_controller_->engine()->SetNextFrameCallback([&]() {
31 | this->Show();
32 | });
33 |
34 | // Flutter can complete the first frame before the "show window" callback is
35 | // registered. The following call ensures a frame is pending to ensure the
36 | // window is shown. It is a no-op if the first frame hasn't completed yet.
37 | flutter_controller_->ForceRedraw();
38 |
39 | return true;
40 | }
41 |
42 | void FlutterWindow::OnDestroy() {
43 | if (flutter_controller_) {
44 | flutter_controller_ = nullptr;
45 | }
46 |
47 | Win32Window::OnDestroy();
48 | }
49 |
50 | LRESULT
51 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message,
52 | WPARAM const wparam,
53 | LPARAM const lparam) noexcept {
54 | // Give Flutter, including plugins, an opportunity to handle window messages.
55 | if (flutter_controller_) {
56 | std::optional result =
57 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam,
58 | lparam);
59 | if (result) {
60 | return *result;
61 | }
62 | }
63 |
64 | switch (message) {
65 | case WM_FONTCHANGE:
66 | flutter_controller_->engine()->ReloadSystemFonts();
67 | break;
68 | }
69 |
70 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam);
71 | }
72 |
--------------------------------------------------------------------------------
/example/ios/Runner/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/test/mocks/mock_platform.dart:
--------------------------------------------------------------------------------
1 | import 'dart:typed_data';
2 |
3 | import 'package:flutter_thermal_printer/flutter_thermal_printer_platform_interface.dart';
4 | import 'package:flutter_thermal_printer/utils/printer.dart';
5 | import 'package:plugin_platform_interface/plugin_platform_interface.dart';
6 |
7 | class MockFlutterThermalPrinterPlatform extends FlutterThermalPrinterPlatform
8 | with MockPlatformInterfaceMixin {
9 | String? platformVersionToReturn = 'Mock Platform 1.0';
10 | List