{"id":25932641,"url":"https://github.com/socketmobile/capturesdk_flutter","last_synced_at":"2026-01-11T13:31:52.670Z","repository":{"id":61972829,"uuid":"461037114","full_name":"SocketMobile/capturesdk_flutter","owner":"SocketMobile","description":"Flutter CaptureSDK","archived":false,"fork":false,"pushed_at":"2025-02-28T15:40:00.000Z","size":797,"stargazers_count":3,"open_issues_count":6,"forks_count":1,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-02-28T20:51:56.791Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SocketMobile.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-02-18T23:33:53.000Z","updated_at":"2025-02-28T15:40:15.000Z","dependencies_parsed_at":"2024-02-06T02:23:52.568Z","dependency_job_id":"5a2fdff3-5c36-4bba-ad06-71f076a48eab","html_url":"https://github.com/SocketMobile/capturesdk_flutter","commit_stats":null,"previous_names":["socketmobile/capturesdk_flutter","socketmobile/capturesdk_flutter_snapshot"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SocketMobile%2Fcapturesdk_flutter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SocketMobile%2Fcapturesdk_flutter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SocketMobile%2Fcapturesdk_flutter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SocketMobile%2Fcapturesdk_flutter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SocketMobile","download_url":"https://codeload.github.com/SocketMobile/capturesdk_flutter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241763763,"owners_count":20016161,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-04T00:38:38.470Z","updated_at":"2026-01-11T13:31:52.663Z","avatar_url":"https://github.com/SocketMobile.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Flutter CaptureSDK - Version 1.5.60\n\nThis is the Flutter CatureSDK for Socket Mobile's Capture library.\n\n## Devices compatibility and CaptureSDK versions\n\n|                    Devices                     | \u003c= 1.2 | 1.3 |   1.4   |   1.5   |\n| :--------------------------------------------: | :----: | :-: | :-----: | :-----: |\n|               **SocketCam C860**               |   ❌   | ❌   |   ✅    |   ✅    |\n|               **SocketCam C820**               |   ❌   | ❌   |   ✅    |   ✅    |\n|               **S720/D720/S820**               |   ❌   | ✅   |   ✅    |   ✅    |\n| **D600, S550, and all other barcode scanners** |   ✅   | ✅   |   ✅    |   ✅    |\n|                    **S370**                    |   ❌   | ❌   |   ✅    |   ✅    |\n|        **DW930/XS930 and DW940/XS940**         |   ❌   | ❌   |   ❌    |   ✅    |\n|                    **S320**                    |   ❌   | ❌   |   ❌    |   ✅    |\n\n## Installation\n\nInstall the flutter package by adding the following to your `pubspec.yaml` file.\n\n```dart\ndependencies:\n  ...\n  capturesdk_flutter: ^1.5.60\n  ...\n```\n\nThen, in your application's `main.dart`, you can import the Flutter CaptureSDK by adding this line to the top of your file.\n\n```dart\nimport 'package:capturesdk_flutter/capturesdk.dart';\n```\n\nFor the rest of the things to add in your project, go to **[iOS](#getting-started-ios)** and **[Android](#getting-started-android)**.\n\n## Getting started iOS (first section) - Important note\n\nYou will need to change three things in your app in order for it to work with iOS. First will need to update the `Podfile` in the `ios` directory of your app in order to be compatible with the version used in our SDK and the source of our iOS CaptureSDK Cocoapods private repository.\n\n```ruby\n  source 'https://github.com/CocoaPods/Specs.git'\n\n  platform :ios, '13.0' # minimum target requirement for CaptureSDK iOS\n\n  target 'MyProject' do\n    ....\n  end\n```\n\n## Getting started\n\nCreate a `Capture` instance with the line `Capture capture = Capture(logger);`. `logger` is an optional argument that is passed to `Capture` and can be helpful with tracing values and requests throughout the app, particularly in `Capture` and `HttpTransport` where the bulk of the Capture logic and requests are handled.\n\nOpen the connection wth the Capture library by using the `open` method on the `Capture` instance. See below.\n\n```dart\nint? response = await capture.openClient(appInfo, _onCaptureEvent);\nstat = 'handle: $response';\nmess = 'capture open success';\n```\n\n`appInfo` is an instance of the `AppInfo` class and consists of the same parameters found in other CaptureSDKs. See an example of `appInfo` below.\n\n```dart\nfinal appInfo = AppInfo(\n        'android:com.example.example',\n        'MC4CFQDNCtjazxILEh8oyT6w/wlaVKqS1gIVAKTz2W6TB9EgmjS1buy0A+3j7nX4',\n        'ios:com.example.example',\n        'MC0CFA1nzK67TLNmSw/QKFUIiedulUUcAhUAzT6EOvRwiZT+h4qyjEZo9oc0ONM=',\n        'bb57d8e1-f911-47ba-b510-693be162686a');\n```\n\nTo generate app info, head to the [docs](https://www.socketmobile.com/developers/portal/application-details/appkey-registration) and follow the prompts to register your app and generate your `appInfo` credentials. See the important section at the end of the README for more information specific to Flutter.\n\nNext, `_onCaptureEvent` is the callback passed to `open` that can handle the event notifications from the CaptureSDK. Below are three important events to consider, which are accessible in the `CaptureEventIds` class.\n\n`deviceArrival` is the event that is triggered when the scanner connects to your device.\n\n`deviceRemoval` is the event that is triggered when the scanner is disconnected from the device.\n\n`decodedData` is the event that is triggered when you scan something with the connected scanner.\n\nSee an example of event handling below in `_onCaptureEvent`.\n\n```dart\n_onCaptureEvent(e, handle) {\n\n    if (e == null) {\n      return;\n    } else if (e.runtimeType == CaptureException) {\n      _updateVals(\"${e.code}\", e.message, e.method, e.details);\n      return;\n    }\n\n    logger.log('onCaptureEvent from: ', '$handle');\n\n    switch (e.id) {\n      case CaptureEventIds.deviceArrival:\n        Capture deviceCapture = Capture(logger);\n\n        setState(() {\n          _deviceCapture = deviceCapture;\n        });\n\n        _openDeviceHelper(deviceCapture, e);\n        break;\n      case CaptureEventIds.deviceRemoval:\n        _closeDeviceHelper(e, handle);\n        break;\n\n      case CaptureEventIds.decodedData:\n        setState(() {\n          /// storing scanned data in state for future use\n          _currentScan = e;\n        });\n        _updateVals('Decoded Data', \"Successful scan!\");\n        break;\n    }\n  }\n```\n\nThe data the user will need to anticipate will be a `CaptureEvent` which might contain an instance of `DecodedData`, `CaptureException`, a client or device handle, etc. When you first connect to the service, the response will be a client handle (an integer) or a `CaptureException` instance will be thrown.\n\nIt's important to create another `Capture` instance when you have successfully connected the scanner to your device (see `var newCapture = Capture(logger);`). This capture instance is tied to your device and will allow the root capture instance to remain open, regardless of what happens with your device. The new instance allows you to create a capture connection to the device to handle various actions specific to the connected device, such as `getProperty` and `setProperty`.\n\n`getProperty` enables you to retrieve specific values for the connected device, such as `friendlyNameDevice` which is the property corresponding to the scanners given name (as opposed to id/guid). Create a property instance with the provided values corresponding to the property id and type, as well an empty object. You can retrieve the friendly name of a device with the following request.\n\n```dart\nFuture\u003cvoid\u003e _handleGetNameProperty() async {\n    CaptureProperty property = CaptureProperty(\n        CapturePropertyIds.friendlyNameDevice,\n        CapturePropertyTypes.none,\n        {});\n\n    try {\n      CaptureProperty propertyResponse =\n          await _deviceCapture!.getProperty(property);\n     print('Successfully Retrieved \"name\" property for device: ${propertyResponse.value}';);\n      //can incorporate UI logic to update device in device list\n    } on CaptureException catch (e) {\n     print(e.code);\n    }\n  }\n```\n\n`setProperty` allows you to update the value of a specific property. The `CaptureProperty` instance you provide is similar to the one in `getProperty` but instead of an empty object for the value, you will send the value you want assigned to the property. You will also send the data type for the property as well instead of `CapturePropertyTypes().none`. In the case of `friendlyNameDevice`, you would send a string value with the type `CapturePropertyTypes().string`. See below.\n\n```dart\nFuture\u003cvoid\u003e _handleSetNameProperty() async {\n    CaptureProperty property = CaptureProperty(\n        CapturePropertyIds.friendlyNameDevice,\n        CapturePropertyTypes.string,\n        _newName);\n\n    try {\n      CaptureProperty propertyResponse =\n          await _deviceCapture!.setProperty(property);\n     print('Successfully set \"name\" property to \"$_newName\".');\n      //can incorporate UI logic to update device in device list\n    } on CaptureException catch (e) {\n     print(e.code);\n    }\n  }\n```\n\nThe response in `setProperty` does not contain a `value` property. You can access the updated value by calling the `getProperty` request after a successful `setProperty` call or you can use the locally stored value that you're using for assignment.\n\n## Getting started iOS\n\nYou will need to change three things in your app in order for it to work with iOS. First will need to update the `Podfile` in the `ios` directory of your app in order to be compatible with the version used in our SDK and the source of our iOS CaptureSDK Cocoapods private repository.\n\n```ruby\n  source 'https://github.com/CocoaPods/Specs.git'\n\n  platform :ios, '13.0'\n\n  target 'MyProject' do\n    ....\n  end\n```\n\nSecond, go to `ios/Runner/Info.plist` and at the bottom, just above `\u003c/dict\u003e`, include the below code.\n\n```plist\n\u003ckey\u003eNSBluetoothAlwaysUsageDescription\u003c/key\u003e\n\u003cstring\u003eBluetooth is needed to connect to a Socket Mobile device\u003c/string\u003e\n\u003ckey\u003eUISupportedExternalAccessoryProtocols\u003c/key\u003e\n\u003carray\u003e\n  \u003cstring\u003ecom.socketmobile.chs\u003c/string\u003e\n\u003c/array\u003e\n\u003ckey\u003eNSCameraUsageDescription\u003c/key\u003e\n  \u003cstring\u003eNeed to enable camera access for SocketCam\u003c/string\u003e\n\u003ckey\u003eLSApplicationQueriesSchemes\u003c/key\u003e\n\u003carray\u003e\n  \u003cstring\u003esktcompanion\u003c/string\u003e\n\u003c/array\u003e\n```\n\nFor SocketCam C860 which is an enhanced version of SocketCam C820, you also need to add the following key to your `Info.plist`: **LSApplicationQueriesSchemes** (*Queried URL Schemes*) with a new item: **sktcompanion** (in lower case).\n\nIn order to use it you have to install [Socket Mobile Companion](https://apps.apple.com/app/socket-mobile-companion/id1175638950) on your device.\n\nYou can find more details about SocketCam C860 [on our website](https://www.socketmobile.com/readers-accessories/data-readers/camera-based-socketcam).\n\nThird, open the project's iOS directory in xcode. Once you've done that, select the Runner and navigate to the build settings. In the search bar, type in 'module' and then look for the portion that says \"Allow Non-modular includes in Framework Modules\". Once that property is location, select \"Yes\". See the image below for what it should look like.\n\n![Build Settings](https://raw.githubusercontent.com/SocketMobile/capturesdk_flutter/main/runnerimg.png)\n\n## Getting started Android\n\nYou will need to update the network configuration to enable the Android Capture client. You can find out more about network configuration [here](https://docs.socketmobile.dev/capture/java/en/latest/android/getting-started.html).\n\nIn order to pass the internet permissions, you need to have the below line in your Android manifest.\n\n```xml\n\u003cuses-permission android:name=\"android.permission.INTERNET\" /\u003e\n```\n\nIn order to use SocketCam C820, you will need to add the below to your Android manifest.\n\n```xml\n    \u003cmeta-data android:name=\"com.socketmobile.capture.APP_KEY\" android:value=\"{YOUR_APP_KEY}\"/\u003e\n    \u003cmeta-data android:name=\"com.socketmobile.capture.DEVELOPER_ID\" android:value=\"{YOUR_DEVELOPER_ID}\"/\u003e\n```\n\nWhere it says `YOUR_APP_KEY`, you need to include the android app key that you got for your app when you registered it. Where it says `YOUR_DEVELOPER_ID` is the developer ID you use for your socket mobile developer portal.\n\nALSO: The package name in `AndroidManifest.xml`, it needs to be both all lowercase and must match your Bundle ID that you have in your app's registration information in your dev portal.\n\n```xml\n\u003cmanifest xmlns:android=\"http://schemas.android.com/apk/res/android\" package=\"com.yourpackagename\"\u003e\n```\n\nIn the `MainActivity.java` file, register the CaptureSDK as a plugin:\n\n```java\npackage com.example.example; // Replace with your app's package name\n\nimport com.capturesdk_flutter.CaptureModule; // import CaptureModule Native Modules\nimport io.flutter.embedding.android.FlutterActivity;\nimport io.flutter.embedding.engine.FlutterEngine;\n\npublic class MainActivity extends FlutterActivity {\n    @Override\n    public void configureFlutterEngine(FlutterEngine flutterEngine) {\n        flutterEngine.getPlugins().add(new CaptureModule(getApplicationContext())); // register CaptureSDK as a plugin here\n    }\n}\n```\n\nIn your app's `builde.gradle` file add the 2 following options:\n\n```java\nbuildTypes {\n    release {\n        minifyEnabled false       \u003c------- to add\n        shrinkResources false     \u003c------- to add\n        signingConfig = signingConfigs.debug\n    }\n}\n```\n\n## Enable Start Capture Service on Android\n\nYou might also have to add the file `network_security_config.xml` file to `android/app/src/main/res/xml` in order to avoid a `clearText` permissions error. See the code below for the file.\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n\u003cnetwork-security-config\u003e\n    \u003cbase-config cleartextTrafficPermitted=\"false\" /\u003e\n    \u003cdomain-config cleartextTrafficPermitted=\"true\"\u003e\n        \u003cdomain includeSubdomains=\"false\"\u003elocalhost\u003c/domain\u003e\n        \u003cdomain includeSubdomains=\"false\"\u003e127.0.0.1\u003c/domain\u003e\n    \u003c/domain-config\u003e\n\u003c/network-security-config\u003e\n```\n\nThen, in their app's `AndroidManifest.xml` file, the developer will need to add the below property into the `\u003capplication\u003e` tag.\n\n```xml\nandroid:networkSecurityConfig=\"@xml/network_security_config\"\n```\n\nFinally, add the below line into just before the `AndroidManifest.xml` file's closing `\u003c/manifest\u003e` tag.\n\n```xml\n\u003cqueries\u003e\n    \u003cpackage android:name=\"com.socketmobile.companion\"/\u003e\n  \u003c/queries\u003e\n```\n\nFor more on the network security configuration for Android, please check out the cleartext section in [the Android docs](https://docs.socketmobile.dev/capture/java/en/latest/android/getting-started.html#enable-cleartext-traffic).\n\n## Important\n\nTo register your app for Flutter, you can select the Flutter language first, and then you can pick one of two platform options; Android and iOS. Below is an example of credentials generated during iOS registration.\n\n![iOS app registration](https://raw.githubusercontent.com/SocketMobile/capturesdk_flutter/main/readme.png)\n\nIf you want to add support for both platforms you will need to generate an app key for one platform first and then the other separately. Once these two keys are generated, all you need to do is inlcude the iOS and Android appKey and appId, respectively, to the same `AppInfo` instance.\n\n```dart\nfinal appInfo = AppInfo(\n        'android:com.example.example',\n        'MC4CFQDNCtjazxILEh8oyT6w/wlaVKqS1gIVAKTz2W6TB9EgmjS1buy0A+3j7nX4',\n        'ios:com.example.example',\n        'MC0CFA1nzK67TLNmSw/QKFUIiedulUUcAhUAzT6EOvRwiZT+h4qyjEZo9oc0ONM=',\n        'bb57d8e1-f911-47ba-b510-693be162686a');\n```\n\nIn order for it to work, you will need to add five argments to `AppInfo` in the following order:\n\n1. Android appId\n2. AppKey after Android registration\n3. iOS appId\n4. AppKey after iOS registration\n5. Developer ID\n\nFor more information about the Flutter CaptureSDK, please visit the [documentation](https://docs.socketmobile.dev/captureflutter/en/latest).\n\nFor a full demonstration, check out [this video](https://vimeo.com/694611104).\n\n## Environment Information\n\nRun `flutter doctor -v` to see your environment tools. Here's what you need:\n\nVisual Studio Code with Flutter extension\n\nFlutter SDK v3.0.0 and Dart v3.0.0 minimum\n\nDevTools v2.31.1 with Chrome as optional\n\nXcode 15\n\nAndroid Studio\n\nTo make sure everything is installed, you can also run `flutter upgrade`. This will upgrade the Flutter SDK and the tools for Android and iOS if needed.\n\n## Build \u0026 Run Instructions\n\n1. `cd example`\n2. Run `flutter pub get`\n\nThen you can run the app through Android Studio and Xcode or through Visual Studio Code directly with the debugger module. See this page for more details: [https://docs.flutter.dev/tools/vs-code#running-and-debugging](https://docs.flutter.dev/tools/vs-code#running-and-debugging).\n\n### Android\n\n3. `cd android`\n4. Run `flutter run` or open the project in Android Studio to run on connected iOS device.\n\n### iOS\n\n3. `cd ios`\n4. Run `pod install --repo-update`\n5. Run `flutter run` or open the project in Xcode to run on connected iOS device.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsocketmobile%2Fcapturesdk_flutter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsocketmobile%2Fcapturesdk_flutter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsocketmobile%2Fcapturesdk_flutter/lists"}