diff --git a/Libraries.txt b/Libraries.txt
index f51b658..36d7477 100644
--- a/Libraries.txt
+++ b/Libraries.txt
@@ -1,40 +1,10 @@
-Open Source libraries used in the Scanbot SDK Flutter Plugin version 7.1.1:
+Open Source libraries used in the Scanbot SDK Flutter Plugin version 8.0.0:
//-------------------------------------------------------------
-collection 1.18.0
-Copyright 2015, the Dart project authors.
+collection 1.19.1
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * 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.
- * Neither the name of Google LLC nor the names of its
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-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
-OWNER 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.
-
-json_serializable
+Copyright 2015, the Dart project authors.
-version 6.6.1
-(https://github.com/dart-lang/json_serializable/blob/master/LICENSE)
-Copyright 2017, the Dart project authors. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
@@ -45,40 +15,7 @@ met:
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
- * Neither the name of Google Inc. nor the names of its
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-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
-OWNER 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.
-
-
-//-------------------------------------------------------------
-json_annotation
-
-version 4.8.1
-(https://github.com/dart-lang/json_serializable/blob/master/LICENSE)
-Copyright 2017, the Dart project authors. All rights reserved.
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * 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.
- * Neither the name of Google Inc. nor the names of its
+ * Neither the name of Google LLC nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
@@ -97,9 +34,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//-------------------------------------------------------------
logging
-version 1.1.1
+version 1.3.0
+
+Copyright 2013, the Dart project authors.
-Copyright 2013, the Dart project authors. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
@@ -110,7 +48,7 @@ met:
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
- * Neither the name of Google Inc. nor the names of its
+ * Neither the name of Google LLC nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
@@ -129,8 +67,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//-------------------------------------------------------------
lints
-version 2.0.1
-
+version 6.0.0
Copyright 2021, the Dart project authors.
@@ -160,13 +97,13 @@ 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.
-
//-------------------------------------------------------------
-build_runner
+ffi
+
+version 2.1.4
-version 2.3.3
+Copyright 2019, the Dart project authors.
-Copyright 2016, the Dart project authors. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
@@ -177,7 +114,7 @@ met:
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
- * Neither the name of Google Inc. nor the names of its
+ * Neither the name of Google LLC nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
@@ -193,30 +130,9 @@ 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.
-
-//-------------------------------------------------------------
-google-gson
-
-version 2.8.5
-(https://github.com/google/gson/blob/gson-parent-2.8.5/LICENSE)
-Copyright 2008 Google Inc.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-
------------------------------------------------------------------------------------------------------------------------
-Open Source libraries used in the Scanbot SDK for Android version 7.1.2
+Open Source libraries used in the Scanbot SDK for Android version 8.0.1
CWAC-Camera
@@ -302,7 +218,7 @@ limitations under the License.
Kotlin Standard Library
-Version 1.9.25
+Version 2.1.21
(https://github.com/JetBrains/kotlin)
Copyright 2010-2018 JetBrains s.r.o.
@@ -372,7 +288,7 @@ limitations under the License.
Dagger
-Version 2.50
+Version 2.56.2
(https://github.com/google/dagger)
Copyright 2012 The Dagger Authors
@@ -702,7 +618,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
expected
-Version 1.1
+Version 1.1.0
(https://github.com/TartanLlama/expected)
Creative Commons Legal Code
@@ -833,7 +749,7 @@ express Statement of Purpose.
flatbuffers
Version 2.0.6
-(https://github.com/google/flatbuffers/tree/master)
+(https://github.com/google/flatbuffers)
Apache License
@@ -1767,7 +1683,7 @@ This work is licensed under a [Creative Commons Attribution-ShareAlike 4.0 Inter
JSON for Modern C++
-Version v3.11.3
+Version 3.11.3
(https://github.com/nlohmann/json)
MIT License
@@ -2177,7 +2093,7 @@ OF THIS SOFTWARE.
libzueci
-Version 1.0.0
+Version 1.0.1
(https://sourceforge.net/projects/libzueci/)
A simple, standalone, BSD-3-Clause C library for converting UTF-8 to/from Extended Channel Interpretations, as
@@ -2590,11 +2506,221 @@ Version 1.1.0h
++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+snowflake-arctic-embed-xs
+
+Version eadfba3b
+(https://huggingface.co/Snowflake/snowflake-arctic-embed-xs/tree/main)
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
spdlog
-Version v1.15.2
+Version 1.15.2
(https://github.com/gabime/spdlog)
The MIT License (MIT)
@@ -3177,7 +3303,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
xtensor
-Version 0.26.0-scanbot
+Version 0.26.0
(https://github.com/doo/xtensor)
Copyright (c) 2016, Johan Mabille, Sylvain Corlay and Wolf Vollprecht
@@ -3489,10 +3615,10 @@ Version 1.1.0
See the License for the specific language governing permissions and
limitations under the License.
-Open Source libraries used in ScanbotSDK for iOS version 7.1.4:
-
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+Open Source libraries used in ScanbotSDK for iOS version 8.0.1:
+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Boost C++
@@ -3790,7 +3916,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
expected
-Version 1.1
+Version 1.1.0
(https://github.com/TartanLlama/expected)
Creative Commons Legal Code
@@ -3921,7 +4047,7 @@ express Statement of Purpose.
flatbuffers
Version 2.0.6
-(https://github.com/google/flatbuffers/tree/master)
+(https://github.com/google/flatbuffers)
Apache License
@@ -4855,7 +4981,7 @@ This work is licensed under a [Creative Commons Attribution-ShareAlike 4.0 Inter
JSON for Modern C++
-Version v3.11.3
+Version 3.11.3
(https://github.com/nlohmann/json)
MIT License
@@ -5265,7 +5391,7 @@ OF THIS SOFTWARE.
libzueci
-Version 1.0.0
+Version 1.0.1
(https://sourceforge.net/projects/libzueci/)
A simple, standalone, BSD-3-Clause C library for converting UTF-8 to/from Extended Channel Interpretations, as
@@ -5678,11 +5804,221 @@ Version 1.1.1t
++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+snowflake-arctic-embed-xs
+
+Version eadfba3b
+(https://huggingface.co/Snowflake/snowflake-arctic-embed-xs/tree/main)
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
spdlog
-Version v1.15.2
+Version 1.15.2
(https://github.com/gabime/spdlog)
The MIT License (MIT)
@@ -6265,7 +6601,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
xtensor
-Version 0.26.0-scanbot
+Version 0.26.0
(https://github.com/doo/xtensor)
Copyright (c) 2016, Johan Mabille, Sylvain Corlay and Wolf Vollprecht
diff --git a/README.md b/README.md
index 38ec35f..f4a840a 100644
--- a/README.md
+++ b/README.md
@@ -105,12 +105,6 @@ Through this feature, our SDK offers document detection and data capture capabil
## Additional information
-### Free integration support
-
-Need help integrating or testing our Document Scanner SDK? We offer [free developer support](https://docs.scanbot.io/support/?utm_source=github.com&utm_medium=referral&utm_campaign=dev_sites) via Slack, MS Teams, or email.
-
-As a customer, you also get access to a dedicated support Slack or Microsoft Teams channel to talk directly to your Customer Success Manager and our engineers.
-
### Trial license and pricing
The Scanbot SDK examples will run for one minute per session without a license. After that, all functionalities and UI components will stop working.
diff --git a/android/app/build.gradle b/android/app/build.gradle
index 6eaf39f..d466ab4 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -7,15 +7,15 @@ plugins {
android {
namespace = "com.example.scanbot_sdk_example_flutter"
- compileSdk = 35
+ compileSdk = 36
compileOptions {
- sourceCompatibility JavaVersion.VERSION_17
- targetCompatibility JavaVersion.VERSION_17
+ sourceCompatibility JavaVersion.VERSION_21
+ targetCompatibility JavaVersion.VERSION_21
}
kotlinOptions {
- jvmTarget = JavaVersion.VERSION_17
+ jvmTarget = JavaVersion.VERSION_21
}
defaultConfig {
diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index 351815b..a074af4 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -8,6 +8,7 @@
+
diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties
index a6ca9e7..d31c8d1 100644
--- a/android/gradle/wrapper/gradle-wrapper.properties
+++ b/android/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
#Fri May 10 16:38:24 CEST 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/android/settings.gradle b/android/settings.gradle
index be7ad30..b72bea5 100644
--- a/android/settings.gradle
+++ b/android/settings.gradle
@@ -18,8 +18,8 @@ pluginManagement {
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
- id "com.android.application" version "8.3.2" apply false
- id "org.jetbrains.kotlin.android" version "1.9.20" apply false
+ id "com.android.application" version "8.10.1" apply false
+ id "org.jetbrains.kotlin.android" version "2.1.21" apply false
}
include ":app"
diff --git a/lib/classic_components/cropping_custom_ui.dart b/lib/classic_components/cropping_custom_ui.dart
index 3827267..9306ad0 100644
--- a/lib/classic_components/cropping_custom_ui.dart
+++ b/lib/classic_components/cropping_custom_ui.dart
@@ -1,21 +1,22 @@
+import 'dart:math';
+
import 'package:flutter/material.dart';
+import 'package:logging/logging.dart';
import 'package:scanbot_sdk/scanbot_sdk.dart';
-import 'package:scanbot_sdk/scanbot_sdk.dart' as sdk;
-import '../storage/_legacy_pages_repository.dart';
import '../utility/utils.dart';
/// This screen demonstrates how to integrate the classical cropping component
class CroppingScreenWidget extends StatefulWidget {
- const CroppingScreenWidget({Key? key, required this.page}) : super(key: key);
- final sdk.Page page;
+ const CroppingScreenWidget({Key? key, required this.documentImage})
+ : super(key: key);
+ final ImageRef documentImage;
@override
_CroppingScreenWidgetState createState() => _CroppingScreenWidgetState();
}
class _CroppingScreenWidgetState extends State {
- final LegacyPageRepository _pageRepository = LegacyPageRepository();
- late sdk.Page currentPage;
+ late ImageRef currentPage;
bool showProgressBar = false;
bool doneButtonEnabled = true;
CroppingController? croppingController;
@@ -23,7 +24,7 @@ class _CroppingScreenWidgetState extends State {
@override
void initState() {
super.initState();
- currentPage = widget.page;
+ currentPage = widget.documentImage;
}
@override
@@ -36,36 +37,13 @@ class _CroppingScreenWidgetState extends State {
if (showProgressBar) _buildProgressBar(),
],
),
- floatingActionButton: _buildFloatingActionButton(),
bottomNavigationBar: _buildBottomAppBar(),
);
}
- Widget _buildFloatingActionButton() {
- return FloatingActionButton(
- onPressed: _handleNextPage,
- child: const Icon(Icons.navigate_next),
- );
- }
-
- Future _handleNextPage() async {
- setState(() {
- showProgressBar = true;
- });
-
- final nextPage = await _pageRepository.nextPage(currentPage);
-
- setState(() {
- showProgressBar = false;
- currentPage = nextPage;
- });
- }
-
AppBar _buildAppBar() {
return AppBar(
- iconTheme: const IconThemeData(
- color: Colors.white,
- ),
+ iconTheme: const IconThemeData(color: Colors.white),
backgroundColor: ScanbotRedColor,
title: const Text(
'Crop document',
@@ -82,17 +60,14 @@ class _CroppingScreenWidgetState extends State {
),
actions: [
if (doneButtonEnabled)
- IconButton(
- icon: const Icon(Icons.done),
- onPressed: cropAndPop,
- ),
+ IconButton(icon: const Icon(Icons.done), onPressed: cropAndPop),
],
);
}
Widget _buildCroppingWidget() {
return ScanbotCroppingWidget(
- page: currentPage,
+ documentImage: currentPage,
onViewReady: (controller) {
croppingController = controller;
},
@@ -101,10 +76,13 @@ class _CroppingScreenWidgetState extends State {
showProgressBar = isProcessing;
});
},
+ onError: (error) {
+ Logger.root.severe(error.toString());
+ },
edgeColor: Colors.red,
edgeColorOnLine: Colors.blue,
anchorPointsColor: Colors.amberAccent,
- borderInsets: sdk.Insets.all(16),
+ borderInsets: Insets.all(16),
);
}
@@ -125,7 +103,7 @@ class _CroppingScreenWidgetState extends State {
children: [
_buildBottomBarButton('Reset', () => croppingController?.reset()),
_buildBottomBarButton('Detect', () => croppingController?.detect()),
- _buildBottomBarButton('Rotate Cw', _rotateImage),
+ _buildBottomBarButton('Rotate \u21BB', _rotateImage),
],
),
);
@@ -134,10 +112,7 @@ class _CroppingScreenWidgetState extends State {
Widget _buildBottomBarButton(String label, VoidCallback onPressed) {
return TextButton(
onPressed: doneButtonEnabled ? onPressed : null,
- child: Text(
- label,
- style: const TextStyle(color: Colors.black),
- ),
+ child: Text(label, style: const TextStyle(color: Colors.black)),
);
}
@@ -155,15 +130,6 @@ class _CroppingScreenWidgetState extends State {
});
}
- Future proceedImage(
- sdk.Page page, CroppingPolygon croppingResult) async {
- return await ScanbotSdk.cropAndRotatePage(
- page,
- croppingResult.polygon,
- croppingResult.rotationTimesCw,
- );
- }
-
Future cropAndPop() async {
setState(() {
showProgressBar = true;
@@ -175,9 +141,38 @@ class _CroppingScreenWidgetState extends State {
showProgressBar = false;
});
- if (croppingResult != null) {
- var newPage = await proceedImage(currentPage, croppingResult);
- Navigator.of(context).pop(newPage);
+ if (croppingResult == null) {
+ Navigator.of(context).pop();
+ return;
+ }
+
+ final documentResult = await ScanbotSdk.document
+ .createDocumentFromImageRefs(images: [currentPage]);
+
+ if (documentResult is! Ok) {
+ print(documentResult.toString());
+ return;
+ }
+
+ final document = documentResult.value;
+
+ final modifiedDocumentResult = await ScanbotSdk.document.modifyPage(
+ document.uuid,
+ document.pages.first.uuid,
+ options: ModifyPageOptions(
+ rotation: ImageRotation.values[croppingResult.rotationTimesCw],
+ polygon: toPointList(croppingResult.polygon),
+ ),
+ );
+
+ if (modifiedDocumentResult is! Ok) {
+ print(modifiedDocumentResult.toString());
+ return;
}
+
+ Navigator.of(context).pop(modifiedDocumentResult.value);
}
-}
\ No newline at end of file
+}
+
+List> toPointList(List polygon) =>
+ polygon.map((p) => Point(p.x, p.y)).toList();
diff --git a/lib/classic_components/custom_ui_menu.dart b/lib/classic_components/custom_ui_menu.dart
deleted file mode 100644
index d65f628..0000000
--- a/lib/classic_components/custom_ui_menu.dart
+++ /dev/null
@@ -1,64 +0,0 @@
-import 'package:flutter/material.dart';
-
-import 'package:scanbot_sdk/scanbot_sdk.dart';
-import 'package:scanbot_sdk/scanbot_sdk.dart' as scanbot_sdk;
-import 'package:scanbot_sdk/scanbot_sdk_ui.dart';
-
-import '../storage/_legacy_pages_repository.dart';
-import '../ui/menu_item_widget.dart';
-import '../ui/preview/_custom_ui_document_preview.dart';
-import '../utility/utils.dart';
-
-import '../ui/preview/medical_certificate_preview.dart';
-
-import 'document_custom_ui.dart';
-import 'medical_certificate_custom_ui.dart';
-
-class CustomUiMenu extends StatelessWidget {
- CustomUiMenu({Key? key}) : super(key: key);
-
- final LegacyPageRepository _pageRepository = LegacyPageRepository();
-
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- appBar: ScanbotAppBar('Scanbot Custom UI Menu'),
- body: ListView(
- children: [
- MenuItemWidget(title: 'Scan Documents', onTap: () => _startDocumentsCustomUIScanner(context)),
- MenuItemWidget(title: 'Scan Medical Certificate', onTap: () => _startMedicalCertificateCustomUIScanner(context)),
- ],
- ),
- );
- }
-
- Future _startDocumentsCustomUIScanner(BuildContext context) async {
- var result = await Navigator.of(context).push(
- MaterialPageRoute(builder: (context) => const DocumentScannerWidget()),
- );
-
- if (result is List) {
- _pageRepository.addPages(result);
- await Navigator.of(context).push(
- MaterialPageRoute(builder: (context) => CustomUiDocumentPreview()),
- );
- }
- }
-
- Future _startMedicalCertificateCustomUIScanner(BuildContext context) async {
- var result = await Navigator.of(context).push(
- MaterialPageRoute(builder: (context) => const MedicalCertificateScannerWidget()),
- );
-
- if (result is MedicalCertificateScanningResult) {
- await Navigator.of(context).push(
- MaterialPageRoute(
- builder: (context) => MedicalCertificatePreviewWidget(result)),
- );
- }
- }
-}
-
-
-
-
diff --git a/lib/classic_components/document_custom_ui.dart b/lib/classic_components/document_custom_ui.dart
index d66331f..db654d4 100644
--- a/lib/classic_components/document_custom_ui.dart
+++ b/lib/classic_components/document_custom_ui.dart
@@ -1,16 +1,13 @@
import 'dart:async';
-import 'dart:io';
import 'package:flutter/material.dart';
import 'package:logging/logging.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:scanbot_sdk/scanbot_sdk.dart';
-import 'package:scanbot_sdk/scanbot_sdk.dart' as sdk;
-import '../storage/_legacy_pages_repository.dart';
-import '../ui/pages_widget.dart';
-import '../ui/preview/_custom_ui_document_preview.dart';
+import '../ui/preview/document_preview.dart';
import '../utility/utils.dart';
+import 'cropping_custom_ui.dart';
/// This screen demonstrates how to integrate the classical barcode scanner component.
class DocumentScannerWidget extends StatefulWidget {
@@ -21,10 +18,6 @@ class DocumentScannerWidget extends StatefulWidget {
}
class _DocumentScannerWidgetState extends State {
- /// Stream used to show live scanned results on top of the camera.
- /// If not needed, scanning stops and returns the first result out of the screen.
- final resultStream = StreamController();
-
/// Stream to monitor the document detection status.
final detectionStatusStream = StreamController();
@@ -34,18 +27,10 @@ class _DocumentScannerWidgetState extends State {
bool autoSnappingEnabled = true;
bool flashAvailable = false;
bool showProgressBar = false;
- bool licenseIsActive = true;
-
- late DocumentSnapTrigger generalSnapTrigger;
- final LegacyPageRepository _pageRepository = LegacyPageRepository();
+ SBException? licenseError;
- /// Adds scanned pages to the repository and navigates to the preview screen.
- void showPageResult(List pages) {
- _pageRepository.addPages(pages);
- Navigator.of(context).push(
- MaterialPageRoute(builder: (context) => CustomUiDocumentPreview()),
- );
- }
+ DocumentScannerCameraController controller =
+ DocumentScannerCameraController();
/// Checks camera permission and updates the state accordingly.
void checkPermission() async {
@@ -75,7 +60,6 @@ class _DocumentScannerWidgetState extends State {
children: [
_buildCameraView(),
_buildDetectionStatusStream(),
- _buildScannedPagePreview(),
if (showProgressBar) _buildProgressIndicator(),
],
),
@@ -85,18 +69,13 @@ class _DocumentScannerWidgetState extends State {
AppBar _buildAppBar() {
return AppBar(
- iconTheme: const IconThemeData(
- color: Colors.white,
- ),
+ iconTheme: const IconThemeData(color: Colors.white),
backgroundColor: ScanbotRedColor,
leading: GestureDetector(
onTap: () {
Navigator.of(context).pop();
},
- child: const Icon(
- Icons.arrow_back,
- color: Colors.white,
- ),
+ child: const Icon(Icons.arrow_back, color: Colors.white),
),
title: const Text(
'Scan Documents',
@@ -113,7 +92,7 @@ class _DocumentScannerWidgetState extends State {
List _buildAppBarActions() {
return [
- if (permissionGranted && licenseIsActive)
+ if (permissionGranted && licenseError == null)
IconButton(
onPressed: () {
if (mounted) {
@@ -137,17 +116,15 @@ class _DocumentScannerWidgetState extends State {
});
}
},
- icon: Icon(
- flashEnabled ? Icons.flash_on : Icons.flash_off,
- ),
+ icon: Icon(flashEnabled ? Icons.flash_on : Icons.flash_off),
),
];
}
/// Builds the view for the camera, handling different states.
Widget _buildCameraView() {
- if (!licenseIsActive) {
- return _buildErrorMessage('License is no longer active');
+ if (licenseError != null) {
+ return _buildErrorMessage(licenseError!.message);
}
if (!permissionGranted) {
@@ -157,31 +134,37 @@ class _DocumentScannerWidgetState extends State {
return Stack(
children: [
DocumentScannerCamera(
- snapListener: (page) {
- resultStream.add(page);
- showPageResult([page]);
+ controller: controller,
+ onSnappedDocumentResult: (
+ ImageRef originalImage,
+ ImageRef? documentImage,
+ DocumentDetectionResult? detectionResult,
+ ) async {
+ await _startCustomCroppingScreen(originalImage);
},
- errorListener: (error) {
- if (mounted) {
+ onError: (error) {
+ if (error is InvalidLicenseException) {
setState(() {
- licenseIsActive = false;
+ licenseError = error;
});
+ } else {
+ Logger.root.severe(error.toString());
}
- Logger.root.severe(error.toString());
},
- documentContourListener: (result) {
- detectionStatusStream.add(result.detectionStatus);
+ onFrameDetectionResult: (result) {
+ detectionStatusStream.add(result.status);
},
configuration: _buildDocumentCameraConfiguration(),
- onCameraPreviewStarted: (snapTrigger, isFlashAvailable) {
+ onCameraPreviewStarted: (isFlashAvailable) {
if (mounted) {
setState(() {
- generalSnapTrigger = snapTrigger;
flashAvailable = isFlashAvailable;
});
}
},
onHeavyOperationProcessing: (show) {
+ if (showProgressBar == show) return;
+
setState(() {
showProgressBar = show;
});
@@ -194,9 +177,9 @@ class _DocumentScannerWidgetState extends State {
alignment: Alignment.bottomCenter,
child: Padding(
padding: const EdgeInsets.all(24.0),
- child: ShutterButton(
+ child: ShutterButtonView(
onPressed: () {
- generalSnapTrigger();
+ controller.snapDocument();
},
autosnappingMode: autoSnappingEnabled,
primaryColor: Colors.pink,
@@ -210,13 +193,34 @@ class _DocumentScannerWidgetState extends State {
);
}
+ Future _startCustomCroppingScreen(ImageRef documentImage) async {
+ if (!await checkLicenseStatus(context)) {
+ return;
+ }
+
+ var documentData = await Navigator.of(context).push(
+ MaterialPageRoute(
+ builder: (context) =>
+ CroppingScreenWidget(documentImage: documentImage),
+ ),
+ );
+
+ if (documentData != null) {
+ await Navigator.of(context).push(
+ MaterialPageRoute(
+ builder: (context) => DocumentPreview(documentData),
+ ),
+ );
+ }
+ }
+
/// Builds the DocumentCameraConfiguration.
DocumentCameraConfiguration _buildDocumentCameraConfiguration() {
var documentClassicScannerConfiguration =
DocumentClassicScannerConfiguration(
autoSnapEnabled: autoSnappingEnabled,
- acceptedSizeScore: 75,
detectDocumentAfterSnap: false,
+ acceptedSizeScore: 75,
autoSnapSensitivity: 0.5,
);
@@ -243,7 +247,9 @@ class _DocumentScannerWidgetState extends State {
return StreamBuilder(
stream: detectionStatusStream.stream,
builder: (context, snapshot) {
- if (snapshot.data == null || !permissionGranted || !licenseIsActive) {
+ if (snapshot.data == null ||
+ !permissionGranted ||
+ licenseError != null) {
return Container();
}
return SizedBox(
@@ -253,8 +259,8 @@ class _DocumentScannerWidgetState extends State {
child: Wrap(
children: [
DetectionStatusWidget(
- status:
- snapshot.data ?? DocumentDetectionStatus.ERROR_NOTHING_DETECTED,
+ status: snapshot.data ??
+ DocumentDetectionStatus.ERROR_NOTHING_DETECTED,
),
],
),
@@ -264,45 +270,13 @@ class _DocumentScannerWidgetState extends State {
);
}
- /// Builds the StreamBuilder for displaying scanned pages.
- Widget _buildScannedPagePreview() {
- return StreamBuilder(
- stream: resultStream.stream,
- builder: (context, snapshot) {
- if (snapshot.data == null) {
- return Container();
- }
- return autoSnappingEnabled
- ? SizedBox(
- width: double.infinity,
- height: double.infinity,
- child: Align(
- alignment: Alignment.bottomRight,
- child: SizedBox(
- width: 100,
- height: 200,
- child: FadeOutView(
- key: Key(snapshot.data?.pageId ?? ""),
- fadeDelay: const Duration(milliseconds: 500),
- child: PagePreview(page: snapshot.data!),
- ),
- ),
- ),
- )
- : Container();
- },
- );
- }
-
/// Builds a progress indicator to show when a heavy operation is in progress.
Widget _buildProgressIndicator() {
return const Center(
child: SizedBox(
width: 100,
height: 100,
- child: CircularProgressIndicator(
- strokeWidth: 10,
- ),
+ child: CircularProgressIndicator(strokeWidth: 10),
),
);
}
@@ -314,10 +288,7 @@ class _DocumentScannerWidgetState extends State {
width: double.infinity,
height: double.infinity,
alignment: Alignment.center,
- child: Text(
- message,
- style: const TextStyle(fontSize: 16),
- ),
+ child: Text(message, style: const TextStyle(fontSize: 16)),
);
}
}
@@ -336,10 +307,7 @@ class DetectionStatusWidget extends StatelessWidget {
color: Colors.green.withAlpha(150),
borderRadius: const BorderRadiusDirectional.all(Radius.circular(5)),
shape: BoxShape.rectangle,
- border: Border.all(
- color: Colors.green.withAlpha(150),
- width: 1.0,
- ),
+ border: Border.all(color: Colors.green.withAlpha(150), width: 1.0),
),
child: Padding(
padding: const EdgeInsets.all(8.0),
@@ -352,32 +320,3 @@ class DetectionStatusWidget extends StatelessWidget {
);
}
}
-
-/// A widget to preview the scanned page.
-class PagePreview extends StatelessWidget {
- final sdk.Page page;
-
- const PagePreview({Key? key, required this.page}) : super(key: key);
-
- @override
- Widget build(BuildContext context) {
- var documentPreviewFile = File.fromUri(page.documentPreviewImageFileUri!);
- var originalPreviewFile = File.fromUri(page.originalPreviewImageFileUri!);
- var file = documentPreviewFile.existsSync()
- ? documentPreviewFile
- : originalPreviewFile;
- var imageUri = documentPreviewFile.existsSync()
- ? page.documentPreviewImageFileUri!
- : page.originalPreviewImageFileUri!;
-
- if (file.existsSync()) {
- return SizedBox(
- height: 200,
- child: shouldInitWithEncryption
- ? EncryptedPageWidget(imageUri)
- : PageWidget(imageUri),
- );
- }
- return Container();
- }
-}
diff --git a/lib/classic_components/medical_certificate_custom_ui.dart b/lib/classic_components/medical_certificate_custom_ui.dart
deleted file mode 100644
index 639b67c..0000000
--- a/lib/classic_components/medical_certificate_custom_ui.dart
+++ /dev/null
@@ -1,232 +0,0 @@
-import 'dart:async';
-import 'package:flutter/material.dart';
-import 'package:flutter/material.dart' as material;
-import 'package:logging/logging.dart';
-import 'package:permission_handler/permission_handler.dart';
-import 'package:scanbot_sdk/scanbot_sdk.dart';
-import 'package:scanbot_sdk_example_flutter/ui/preview/medical_certificate_preview.dart';
-import '../utility/utils.dart';
-
-class MedicalCertificateScannerWidget extends StatefulWidget {
- const MedicalCertificateScannerWidget({Key? key}) : super(key: key);
-
- @override
- _MedicalCertificateScannerWidgetState createState() =>
- _MedicalCertificateScannerWidgetState();
-}
-
-class _MedicalCertificateScannerWidgetState
- extends State {
- bool permissionGranted = false;
- bool flashEnabled = false;
- bool flashAvailable = false;
- bool showProgressBar = false;
- bool licenseIsActive = true;
-
- @override
- void initState() {
- super.initState();
- _checkPermission(); // Check for camera permissions when initializing the widget
- }
-
- // Check and request camera permissions
- void _checkPermission() async {
- final permissionResult = await [Permission.camera].request();
- setState(() {
- permissionGranted =
- permissionResult[Permission.camera]?.isGranted ?? false;
- });
- }
-
- // Handle the scanning result and navigate to the result screen
- Future _showResult(MedicalCertificateScanningResult scanningResult) async {
- Navigator.of(context).push(
- MaterialPageRoute(
- builder: (context) => MedicalCertificatePreviewWidget(scanningResult),
- ),
- );
- }
-
- // Configuration for the Medical Certificate Classic Scanner
- MedicalCertificateClassicScannerConfiguration _buildScannerConfiguration() {
- return MedicalCertificateClassicScannerConfiguration(
- recognizePatientInfo: true,
- recognizeBarcode: true,
- captureHighResolutionImage: true,
- );
- }
-
- // Configuration for the Finder (area to scan)
- FinderConfiguration _buildFinderConfiguration() {
- return FinderConfiguration(
- // finderAspectRatio: sdk.AspectRatio(width: 3.0, height: 4.0),
- onFinderRectChange: (left, top, right, bottom) {
- // aligning some text view to the finder dynamically by calculating its position from finder changes
- },
- topWidget: const Center(
- child: Text(
- 'Top hint text in centre',
- style: TextStyle(color: Colors.white),
- ),
- ),
- bottomWidget: const Align(
- alignment: Alignment.topCenter,
- child: Text(
- 'Bottom hint text in topCenter',
- style: TextStyle(color: Colors.white),
- ),
- ),
- widget: Center(
- child: Padding(
- padding: const EdgeInsets.all(16),
- child: material.AspectRatio(
- aspectRatio: 4 / 3.0,
- child: Container(
- decoration: BoxDecoration(
- border: Border.all(
- width: 5,
- color: Colors.lightBlue.withAlpha(155),
- ),
- borderRadius: const BorderRadius.all(Radius.circular(20)),
- ),
- ),
- ),
- ),
- ),
- decoration: BoxDecoration(
- border: Border.all(
- width: 5,
- color: Colors.deepPurple,
- ),
- borderRadius: const BorderRadius.all(Radius.circular(20)),
- ),
- backgroundColor: Colors.amber.withAlpha(150),
- );
- }
-
- // Configuration for the Medical Certificate Camera
- MedicalCertificateCameraConfiguration _buildCameraConfiguration() {
- return MedicalCertificateCameraConfiguration(
- flashEnabled: flashEnabled, // Initial flash state
- scannerConfiguration:
- _buildScannerConfiguration(), // Scanner configuration
- finder: _buildFinderConfiguration(), // Finder configuration
- );
- }
-
- AppBar _buildAppBar() {
- return AppBar(
- iconTheme: const IconThemeData(
- color: Colors.white,
- ),
- leading: GestureDetector(
- onTap: () {
- Navigator.of(context).pop();
- },
- child: const Icon(
- Icons.arrow_back,
- color: Colors.white,
- ),
- ),
- backgroundColor: ScanbotRedColor,
- title: const Text(
- 'Scan Medical Certificate',
- style: TextStyle(
- fontSize: 20,
- fontWeight: FontWeight.w400,
- color: Colors.white,
- fontFamily: 'Roboto',
- ),
- ),
- actions: [
- if (flashAvailable)
- IconButton(
- onPressed: () {
- if (mounted) {
- setState(() {
- flashEnabled = !flashEnabled;
- });
- }
- },
- icon: Icon(
- flashEnabled ? Icons.flash_on : Icons.flash_off,
- color: Colors.white,
- ),
- ),
- ],
- );
- }
-
- // Error message display for permissions and license status
- Widget _buildErrorMessage(String message) {
- return Container(
- color: Colors.white,
- width: double.infinity,
- height: double.infinity,
- alignment: Alignment.center,
- child: Text(
- message,
- style: const TextStyle(fontSize: 16),
- ),
- );
- }
-
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- appBar: _buildAppBar(),
- body: Container(
- color: Colors.black,
- child: Stack(
- children: [
- // Show camera view if license is active and permissions are granted, otherwise show an error message
- licenseIsActive
- ? permissionGranted
- ? MedicalCertificateScannerCamera(
- configuration: _buildCameraConfiguration(),
- onCameraPreviewStarted: (isFlashAvailable) {
- if (mounted) {
- setState(() {
- flashAvailable = isFlashAvailable;
- });
- }
- },
- mcListener: (scanningResult) {
- if (scanningResult.scanningSuccessful) {
- _showResult(scanningResult);
- }
- },
- errorListener: (error) {
- if (mounted) {
- setState(() {
- licenseIsActive = false;
- });
- }
- Logger.root.severe(error.toString());
- },
- onHeavyOperationProcessing: (show) {
- setState(() {
- showProgressBar = show;
- });
- },
- )
- : _buildErrorMessage('Permissions not granted')
- : _buildErrorMessage('License has expired'),
-
- // Show progress indicator if a heavy operation is in progress
- if (showProgressBar)
- const Center(
- child: SizedBox(
- width: 100,
- height: 100,
- child: CircularProgressIndicator(
- strokeWidth: 10,
- ),
- ),
- ),
- ],
- ),
- ),
- );
- }
-}
diff --git a/lib/data_capture/_legacy_use_cases.dart b/lib/data_capture/_legacy_use_cases.dart
deleted file mode 100644
index b4c562c..0000000
--- a/lib/data_capture/_legacy_use_cases.dart
+++ /dev/null
@@ -1,158 +0,0 @@
-import 'package:flutter/material.dart';
-import 'package:logging/logging.dart';
-import 'package:scanbot_sdk/scanbot_sdk_ui.dart';
-
-import '../ui/menu_item_widget.dart';
-import '../ui/preview/check_preview.dart';
-import '../ui/preview/ehic_preview.dart';
-import '../ui/preview/medical_certificate_preview.dart';
-import '../ui/preview/vin_preview.dart';
-import '../utility/utils.dart';
-
-class LegacyDataCaptureUseCases extends StatelessWidget {
- const LegacyDataCaptureUseCases({Key? key}) : super(key: key);
-
- @override
- Widget build(BuildContext context) {
- return Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- const TitleItemWidget(title: 'Legacy Data Detectors'),
- MenuItemWidget(
- title: "Scan EHIC (European Health Insurance Card)",
- onTap: () => startEhicScanner(context)),
- MenuItemWidget(
- title: "Scan VIN", onTap: () => startVINScanner(context)),
- MenuItemWidget(
- title: "Scan Check", onTap: () => startCheckScanner(context)),
- MenuItemWidget(
- title: "Scan Medical Certificate",
- onTap: () => startMedicalCertificateScanner(context)),
-
- ],
- );
- }
-
- Future startDetector({
- required BuildContext context,
- required Future Function() scannerFunction,
- required Future Function(BuildContext, T result) handleResult,
- }) async {
- if (!await checkLicenseStatus(context)) return;
-
- try {
- final result = await scannerFunction();
- await handleResult(context, result);
- } catch (e) {
- Logger.root.severe(e);
- }
- }
-
- Future startVINScanner(BuildContext context) async {
- var configuration = VinScannerScreenConfiguration();
- configuration.topBarBackgroundColor = ScanbotRedColor;
- configuration.topBarButtonsActiveColor = Colors.white;
- // Configure other parameters as needed.
-
- await startDetector>(
- context: context,
- scannerFunction: () => ScanbotSdkUi.startVinScanner(configuration),
- handleResult: (context, result) async {
- if (result.status == OperationStatus.OK) {
- await Navigator.of(context).push(
- MaterialPageRoute(
- builder: (context) => VinScannerResultPreview(scanningResult: result.data!)),
- );
- } else {
- await showAlertDialog(
- context, "Operation Status: ${result.status.name}");
- }
- },
- );
- }
-
- Future startCheckScanner(BuildContext context) async {
- var configuration = CheckScannerScreenConfiguration();
- configuration.topBarBackgroundColor = ScanbotRedColor;
- configuration.topBarButtonsActiveColor = Colors.white;
- // Configure other parameters as needed.
-
- await startDetector>(
- context: context,
- scannerFunction: () => _runCheckScanner(configuration),
- handleResult: (context, result) async {
- if (result.status == OperationStatus.OK) {
- await Navigator.of(context).push(
- MaterialPageRoute(
- builder: (context) => CheckDocumentResultPreview(scanningResult: result.data!)),
- );
- } else {
- await showAlertDialog(
- context, "Operation Status: ${result.status.name}");
- }
- },
- );
- }
-
- Future> _runCheckScanner(
- CheckScannerScreenConfiguration configuration) async {
- /// You must use autorelease for result object
- /// otherwise you'll get exception "AutoReleasable objects must be created within autorelease"
-
- return await autorelease(() async {
- var checkScanningResult = await ScanbotSdkUi.startCheckScanner(configuration);
- /// if you want to use image later, call encodeImages() to save in buffer
- // checkScanningResult.data?.encodeImages();
- return checkScanningResult;
- });
- }
-
- Future startMedicalCertificateScanner(BuildContext context) async {
- var configuration = MedicalCertificateScannerConfiguration();
- configuration.returnCroppedDocumentImage = false;
- configuration.topBarBackgroundColor = ScanbotRedColor;
- configuration.topBarButtonsActiveColor = Colors.white;
- // Configure other parameters as needed.
-
- await startDetector>(
- context: context,
- scannerFunction: () =>
- ScanbotSdkUi.startMedicalCertificateScanner(configuration),
- handleResult: (context, result) async {
- if (result.status == OperationStatus.OK) {
- await Navigator.of(context).push(
- MaterialPageRoute(
- builder: (context) =>
- MedicalCertificatePreviewWidget(result.data!)),
- );
- } else {
- await showAlertDialog(
- context, "Operation Status: ${result.status.name}");
- }
- },
- );
- }
-
- Future startEhicScanner(BuildContext context) async {
- var configuration = HealthInsuranceCardScannerConfiguration();
- // Configure parameters as needed.
-
- await startDetector<
- ResultWrapper>(
- context: context,
- scannerFunction: () => ScanbotSdkUi.startEhicScanner(configuration),
- handleResult: (context, result) async {
- if (result.status == OperationStatus.OK) {
- await Navigator.of(context).push(
- MaterialPageRoute(
- builder: (context) =>
- EuropeanHealthInsuranceCardResultPreview(result.data!)),
- );
- } else {
- await showAlertDialog(
- context, "Operation Status: ${result.status.name}");
- }
- },
- );
- }
-}
diff --git a/lib/data_capture/data_capture_sdk_menu.dart b/lib/data_capture/data_capture_sdk_menu.dart
index 5725436..ad7512e 100644
--- a/lib/data_capture/data_capture_sdk_menu.dart
+++ b/lib/data_capture/data_capture_sdk_menu.dart
@@ -1,7 +1,6 @@
import 'package:flutter/material.dart';
import '../utility/utils.dart';
-import '_legacy_use_cases.dart';
import 'data_capture_use_cases.dart';
class DataCaptureSdkMenu extends StatelessWidget {
@@ -11,13 +10,7 @@ class DataCaptureSdkMenu extends StatelessWidget {
Widget build(BuildContext context) {
return Scaffold(
appBar: ScanbotAppBar('Scanbot Data Capture SDK Menu'),
- body: ListView(
- children: const [
- DataCaptureUseCases(),
- LegacyDataCaptureUseCases(),
- ],
- ),
+ body: ListView(children: const [DataCaptureUseCases()]),
);
}
}
-
diff --git a/lib/data_capture/data_capture_use_cases.dart b/lib/data_capture/data_capture_use_cases.dart
index 25246c9..6557f87 100644
--- a/lib/data_capture/data_capture_use_cases.dart
+++ b/lib/data_capture/data_capture_use_cases.dart
@@ -1,14 +1,10 @@
import 'package:flutter/material.dart';
-import 'package:logging/logging.dart';
import 'package:scanbot_sdk/scanbot_sdk.dart';
-import 'package:scanbot_sdk/scanbot_sdk_ui_v2.dart';
import 'package:scanbot_sdk_example_flutter/ui/preview/check_preview.dart';
import 'package:scanbot_sdk_example_flutter/ui/preview/credit_card_preview.dart';
import '../ui/menu_item_widget.dart';
-import '../ui/preview/ehic_preview.dart';
import '../ui/preview/extracted_document_data_preview.dart';
-import '../ui/preview/medical_certificate_preview.dart';
import '../ui/preview/mrz_document_preview.dart';
import '../ui/preview/text_pattern_preview.dart';
import '../ui/preview/vin_preview.dart';
@@ -23,49 +19,55 @@ class DataCaptureUseCases extends StatelessWidget {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- const TitleItemWidget(title: 'Recognizers'),
+ const TitleItemWidget(title: 'Data Detectors on Still Images'),
MenuItemWidget(
- title: "Recognize MRZ from Still Image",
- onTap: () => _recognizeMrzOnImage(context)),
+ title: "Scan MRZ from Still Image",
+ onTap: () => _scanMrzOnImage(context),
+ ),
MenuItemWidget(
- title: "Recognize Medical Certificate from Still Image",
- onTap: () => _recognizeMedicalCertificateOnImage(context)),
+ title: "Extract Document Data from Still Image",
+ onTap: () => _extractDocumentDataFromImage(context),
+ ),
MenuItemWidget(
- title: "Recognize EHIC from Still Image",
- onTap: () => _recognizeHealthInsuranceCardOnImage(context)),
+ title: "Scan Check from Still Image",
+ onTap: () => _scanCheckOnImage(context),
+ ),
MenuItemWidget(
- title: "Extract Document Data from Still Image",
- onTap: () => _extractDocumentDataFromImage(context)),
- MenuItemWidget(
- title: "Recognize Check from Still Image",
- onTap: () => _recognizeCheckOnImage(context)),
- MenuItemWidget(
- title: "Recognize Credit Card from Still Image",
- onTap: () => _recognizeCreditCardOnImage(context)),
+ title: "Scan Credit Card from Still Image",
+ onTap: () => _scanCreditCardOnImage(context),
+ ),
const TitleItemWidget(title: 'Data Detectors'),
MenuItemWidget(
- title: "Extract Document Data",
- onTap: () => _startDocumentDataExtractorScanner(context)),
+ title: "Scan MRZ (Machine Readable Zone)",
+ onTap: () => startMRZScanner(context),
+ ),
MenuItemWidget(
- title: "Scan MRZ (Machine Readable Zone)",
- onTap: () => startMRZScanner(context)),
+ title: "Extract Document Data",
+ onTap: () => _startDocumentDataExtractorScanner(context),
+ ),
MenuItemWidget(
- title: "Scan VIN", onTap: () => startVINScanner(context)),
+ title: "Scan VIN",
+ onTap: () => startVINScanner(context),
+ ),
MenuItemWidget(
- title: "Scan Check", onTap: () => startCheckScanner(context)),
+ title: "Scan Check",
+ onTap: () => startCheckScanner(context),
+ ),
MenuItemWidget(
- title: "Scan Text Data",
- onTap: () => startTextDataScanner(context)),
+ title: "Scan Text Data",
+ onTap: () => startTextDataScanner(context),
+ ),
MenuItemWidget(
- title: "Scan Credit Scanner",
- onTap: () => startCreditCardScanner(context)),
+ title: "Scan Credit Scanner",
+ onTap: () => startCreditCardScanner(context),
+ ),
],
);
}
- Future startRecognizer({
+ Future scanOnImage({
required BuildContext context,
- required Future Function(String path) scannerFunction,
+ required Future> Function(String path) scannerFunction,
required Future Function(BuildContext, T result) handleResult,
}) async {
if (!await checkLicenseStatus(context)) return;
@@ -73,53 +75,48 @@ class DataCaptureUseCases extends StatelessWidget {
final dialog = ProgressDialog(context);
dialog.style(message: 'Please wait...');
- try {
- final response = await selectImageFromLibrary();
+ final response = await selectImageFromLibrary();
- if (response != null && response.path.isNotEmpty) {
- dialog.show();
+ if (response != null && response.path.isNotEmpty) {
+ dialog.show();
- final result = await scannerFunction(response.path);
- await handleResult(context, result);
- await dialog.hide();
+ final result = await scannerFunction(response.path);
+ if (result is Ok) {
+ await handleResult(context, result.value);
+ } else {
+ print(result.toString());
}
- } catch (e) {
- Logger.root.severe(e);
- } finally {
await dialog.hide();
}
}
- Future startDetector({
+ Future startScanner({
required BuildContext context,
required Future Function() scannerFunction,
required Future Function(BuildContext, T result) handleResult,
}) async {
if (!await checkLicenseStatus(context)) return;
- try {
- final result = await scannerFunction();
- await handleResult(context, result);
- } catch (e) {
- Logger.root.severe(e);
- }
+ final result = await scannerFunction();
+ await handleResult(context, result);
}
- Future _recognizeMrzOnImage(BuildContext context) async {
+ Future _scanMrzOnImage(BuildContext context) async {
var configuration = MrzScannerConfiguration();
configuration.incompleteResultHandling = MrzIncompleteResultHandling.REJECT;
// Configure other parameters as needed.
- await startRecognizer(
+ await scanOnImage(
context: context,
- scannerFunction: (path) => ScanbotSdk.recognizeOperations
- .recognizeMrzOnImage(path, configuration),
+ scannerFunction: (path) =>
+ ScanbotSdk.mrz.scanFromImageFileUri(path, configuration),
handleResult: (context, result) async {
if (result.success) {
await Navigator.of(context).push(
MaterialPageRoute(
- builder: (context) =>
- MrzDocumentResultPreview(scannerResult: result)),
+ builder: (context) =>
+ MrzDocumentResultPreview(scannerResult: result),
+ ),
);
} else {
await showAlertDialog(context, "Operation Status: ${result.success}");
@@ -128,186 +125,140 @@ class DataCaptureUseCases extends StatelessWidget {
);
}
- Future _recognizeMedicalCertificateOnImage(BuildContext context) async {
- var configuration = MedicalCertificateScanningParameters();
- configuration.recognizePatientInfoBox = true;
+ Future _extractDocumentDataFromImage(BuildContext context) async {
+ var commonConfig = DocumentDataExtractorCommonConfiguration(
+ acceptedDocumentTypes: [
+ DeIdCardFront.DOCUMENT_TYPE,
+ DeIdCardBack.DOCUMENT_TYPE,
+ DeHealthInsuranceCardFront.DOCUMENT_TYPE,
+ DePassport.DOCUMENT_TYPE,
+ DeResidencePermitFront.DOCUMENT_TYPE,
+ DeResidencePermitBack.DOCUMENT_TYPE,
+ EuropeanDriverLicenseFront.DOCUMENT_TYPE,
+ EuropeanDriverLicenseBack.DOCUMENT_TYPE,
+ EuropeanHealthInsuranceCard.DOCUMENT_TYPE,
+ ],
+ );
+
+ var configuration = DocumentDataExtractorConfiguration(
+ configurations: [commonConfig],
+ );
// Configure other parameters as needed.
- await startRecognizer(
+ await scanOnImage(
context: context,
- scannerFunction: (path) => ScanbotSdk.recognizeOperations
- .recognizeMedicalCertificateOnImage(path, configuration),
+ scannerFunction: (path) => ScanbotSdk.documentDataExtractor
+ .extractFromImageFileUri(path, configuration),
handleResult: (context, result) async {
- if (result.scanningSuccessful) {
+ if (result.document != null) {
await Navigator.of(context).push(
MaterialPageRoute(
- builder: (context) => MedicalCertificatePreviewWidget(result)),
+ builder: (context) =>
+ ExtractedDocumentDataPreview(scanningResult: result),
+ ),
);
} else {
await showAlertDialog(
- context, "Operation Status: ${result.scanningSuccessful}");
+ context,
+ "Operation Status: ${result.status.name}",
+ );
}
},
);
}
- Future _recognizeHealthInsuranceCardOnImage(
- BuildContext context) async {
- var configuration = EuropeanHealthInsuranceCardRecognizerConfiguration();
- configuration.maxExpirationYear = 2100;
+ Future _scanCheckOnImage(BuildContext context) async {
+ var configuration = CheckScannerConfiguration();
+ configuration.documentDetectionMode =
+ CheckDocumentDetectionMode.DETECT_AND_CROP_DOCUMENT;
// Configure other parameters as needed.
- await startRecognizer(
+ await scanOnImage(
context: context,
- scannerFunction: (path) => ScanbotSdk.recognizeOperations
- .recognizeHealthInsuranceCardOnImage(path, configuration),
+ scannerFunction: (path) => ScanbotSdk.check.scanFromImageFileUri(
+ path,
+ configuration,
+ ),
handleResult: (context, result) async {
if (result.status ==
- EuropeanHealthInsuranceCardRecognitionResultRecognitionStatus
- .SUCCESS) {
+ CheckMagneticInkStripScanningStatus.ERROR_NOTHING_FOUND) {
+ await showAlertDialog(
+ context,
+ "Operation Status: ${result.status.name}",
+ );
+ } else {
await Navigator.of(context).push(
MaterialPageRoute(
- builder: (context) =>
- EuropeanHealthInsuranceCardResultPreview(result)),
+ builder: (context) =>
+ CheckDocumentResultPreview(scanningResult: result),
+ ),
);
- } else {
- await showAlertDialog(
- context, "Operation Status: ${result.status.name}");
}
},
);
}
- Future _extractDocumentDataFromImage(BuildContext context) async {
- var commonConfig = DocumentDataExtractorCommonConfiguration(acceptedDocumentTypes: [
- DeIdCardFront.DOCUMENT_TYPE,
- DeIdCardBack.DOCUMENT_TYPE,
- DeHealthInsuranceCardFront.DOCUMENT_TYPE,
- DePassport.DOCUMENT_TYPE,
- DeResidencePermitFront.DOCUMENT_TYPE,
- DeResidencePermitBack.DOCUMENT_TYPE,
- EuropeanDriverLicenseFront.DOCUMENT_TYPE,
- EuropeanDriverLicenseBack.DOCUMENT_TYPE,
- EuropeanHealthInsuranceCard.DOCUMENT_TYPE,
- ]);
-
- var configuration = DocumentDataExtractorConfiguration(
- configurations: [commonConfig],
- );
- // Configure other parameters as needed.
-
- await startRecognizer(
- context: context,
- scannerFunction: (path) =>
- _runDocumentDataRecognizer(configuration, path),
- handleResult: (context, result) async {
- if (result.document != null) {
- await Navigator.of(context).push(
- MaterialPageRoute(
- builder: (context) => ExtractedDocumentDataPreview(scanningResult: result)),
- );
- } else {
- await showAlertDialog(
- context, "Operation Status: ${result.status.name}");
- }
- });
- }
-
- Future _runDocumentDataRecognizer(
- DocumentDataExtractorConfiguration configuration, String path) async {
- /// You must use autorelease for result object
- /// otherwise you'll get exception "AutoReleasable objects must be created within autorelease"
-
- return await autorelease(() async {
- var extractedData = await ScanbotSdk.recognizeOperations.extractDocumentDataFromImage(path, configuration);
- /// if you want to use image later, call encodeImages() to save in buffer
- // extractedData.encodeImages();
- return extractedData;
- });
- }
-
- Future _recognizeCheckOnImage(BuildContext context) async {
- var configuration = CheckScannerConfiguration();
- configuration.documentDetectionMode =
- CheckDocumentDetectionMode.DETECT_AND_CROP_DOCUMENT;
+ Future _scanCreditCardOnImage(BuildContext context) async {
+ var configuration = CreditCardScannerConfiguration();
+ configuration.requireExpiryDate = true;
// Configure other parameters as needed.
- await startRecognizer(
+ await scanOnImage(
context: context,
- scannerFunction: (path) => _runCheckRecognize(configuration, path),
+ scannerFunction: (path) =>
+ ScanbotSdk.creditCard.scanFromImageFileUri(path, configuration),
handleResult: (context, result) async {
- if (result.status == CheckMagneticInkStripScanningStatus.ERROR_NOTHING_FOUND) {
- await showAlertDialog(context, "Operation Status: ${result.status.name}");
- } else {
+ if (result.scanningStatus !=
+ CreditCardScanningStatus.ERROR_NOTHING_FOUND) {
await Navigator.of(context).push(
MaterialPageRoute(
- builder: (context) => CheckDocumentResultPreview(scanningResult: result)),
+ builder: (context) =>
+ CreditCardResultPreview(scanningResult: result),
+ ),
+ );
+ } else {
+ await showAlertDialog(
+ context,
+ "Operation Status: ${result.scanningStatus.name}",
);
}
},
);
}
- Future _runCheckRecognize(
- CheckScannerConfiguration configuration, String path) async {
- /// You must use autorelease for result object
- /// otherwise you'll get exception "AutoReleasable objects must be created within autorelease"
-
- return await autorelease(() async {
- var checkScanningResult = await ScanbotSdk.recognizeOperations.recognizeCheckOnImage(path, configuration);
- /// if you want to use image later, call encodeImages() to save in buffer
- // checkScanningResult.encodeImages();
- return checkScanningResult;
- });
- }
-
- Future _recognizeCreditCardOnImage(BuildContext context) async {
- var configuration = CreditCardScannerConfiguration();
- configuration.requireExpiryDate = true;
- // Configure other parameters as needed.
-
- await startRecognizer(
- context: context,
- scannerFunction: (path) => ScanbotSdk.recognizeOperations
- .recognizeCreditCardOnImage(path, configuration),
- handleResult: (context, result) async {
- if (result.scanningStatus !=
- CreditCardScanningStatus.ERROR_NOTHING_FOUND) {
- await Navigator.of(context).push(
- MaterialPageRoute(
- builder: (context) =>
- CreditCardResultPreview(scanningResult: result)),
- );
- } else {
- await showAlertDialog(
- context, "Operation Status: ${result.scanningStatus.name}");
- }
- });
- }
-
Future startVINScanner(BuildContext context) async {
var configuration = VinScannerScreenConfiguration();
configuration.introScreen.explanation.text =
- 'Quickly and securely scan the VIN by holding your device over the vehicle identification number or vehicle identification barcode' +
- '\\nThe scanner will guide you to the optimal scanning position.' +
+ 'Quickly and securely scan the VIN by holding your device over the vehicle identification number or vehicle identification barcode'
+ '\\nThe scanner will guide you to the optimal scanning position.'
'Once the scan is complete, your VIN details will automatically be extracted and processed.';
// Configure the done button. E.g., the text or the background color.
configuration.introScreen.doneButton.text = 'Start Scanning';
- configuration.introScreen.doneButton.background.fillColor = ScanbotColor('#C8193C');
+ configuration.introScreen.doneButton.background.fillColor = ScanbotColor(
+ '#C8193C',
+ );
// Configure other parameters as needed.
- await startDetector>(
+ await startScanner>(
context: context,
- scannerFunction: () => ScanbotSdkUiV2.startVINScanner(configuration),
+ scannerFunction: () => ScanbotSdk.vin.startScanner(configuration),
handleResult: (context, result) async {
- if (result.status == OperationStatus.OK) {
- await Navigator.of(context).push(
- MaterialPageRoute(
- builder: (context) => VinScannerResultPreview(uiResult: result.data!)),
- );
- } else {
- await showAlertDialog(
- context, "Operation Status: ${result.status.name}");
+ switch (result) {
+ case Ok():
+ await Navigator.of(context).push(
+ MaterialPageRoute(
+ builder: (context) =>
+ VinScannerResultPreview(uiResult: result.value),
+ ),
+ );
+ case Error():
+ await showAlertDialog(
+ context,
+ title: "Error",
+ result.error.message,
+ );
+ case Cancel():
+ print("Operation was canceled");
}
},
);
@@ -318,40 +269,32 @@ class DataCaptureUseCases extends StatelessWidget {
configuration.viewFinder.overlayColor = ScanbotColor('#C8193C');
// Configure other parameters as needed.
- await startDetector>(
+ await startScanner>(
context: context,
- scannerFunction: () => _runDocumentDataExtractor(configuration),
+ scannerFunction: () =>
+ ScanbotSdk.documentDataExtractor.startExtractorScreen(configuration),
handleResult: (context, result) async {
- if (result.status == OperationStatus.OK) {
- await Navigator.of(context).push(
- MaterialPageRoute(
+ switch (result) {
+ case Ok():
+ await Navigator.of(context).push(
+ MaterialPageRoute(
builder: (context) =>
- ExtractedDocumentDataPreview(uiResult: result.data!)),
- );
- } else {
- await showAlertDialog(
- context, "Operation Status: ${result.status.name}");
+ ExtractedDocumentDataPreview(uiResult: result.value),
+ ),
+ );
+ case Error():
+ await showAlertDialog(
+ context,
+ title: "Error",
+ result.error.message,
+ );
+ case Cancel():
+ print("Operation was canceled");
}
},
);
}
- Future>
- _runDocumentDataExtractor(
- DocumentDataExtractorScreenConfiguration configuration) async {
- /// You must use autorelease for result object
- /// otherwise you'll get exception "AutoReleasable objects must be created within autorelease"
-
- return await autorelease(() async {
- var extractedData = await ScanbotSdkUiV2.startDocumentDataExtractor(configuration);
- /// if you want to use image later, call encodeImages() to save in buffer
- // extractedData.data?.forEach((item) {
- // item.encodeImages();
- // });
- return extractedData;
- });
- }
-
Future startCheckScanner(BuildContext context) async {
var configuration = CheckScannerScreenConfiguration();
// Modify behaviors
@@ -361,36 +304,31 @@ class DataCaptureUseCases extends StatelessWidget {
configuration.palette.sbColorOnPrimary = ScanbotColor('#FFFFFF');
// Configure other parameters as needed.
- await startDetector>(
+ await startScanner>(
context: context,
- scannerFunction: () => _runCheckScanner(configuration),
+ scannerFunction: () => ScanbotSdk.check.startScanner(configuration),
handleResult: (context, result) async {
- if (result.status == OperationStatus.OK) {
- await Navigator.of(context).push(
- MaterialPageRoute(
- builder: (context) => CheckDocumentResultPreview(uiResult: result.data!)),
- );
- } else {
- await showAlertDialog(
- context, "Operation Status: ${result.status.name}");
+ switch (result) {
+ case Ok():
+ await Navigator.of(context).push(
+ MaterialPageRoute(
+ builder: (context) =>
+ CheckDocumentResultPreview(uiResult: result.value),
+ ),
+ );
+ case Error():
+ await showAlertDialog(
+ context,
+ title: "Error",
+ result.error.message,
+ );
+ case Cancel():
+ print("Operation was canceled");
}
},
);
}
- Future> _runCheckScanner(
- CheckScannerScreenConfiguration configuration) async {
- /// You must use autorelease for result object
- /// otherwise you'll get exception "AutoReleasable objects must be created within autorelease"
-
- return await autorelease(() async {
- var checkScanningResult = await ScanbotSdkUiV2.startCheckScanner(configuration);
- /// if you want to use image later, call encodeImages() to save in buffer
- // checkScanningResult.data?.encodeImages();
- return checkScanningResult;
- });
- }
-
Future startTextDataScanner(BuildContext context) async {
var configuration = TextPatternScannerScreenConfiguration();
// Show the top user guidance
@@ -399,20 +337,26 @@ class DataCaptureUseCases extends StatelessWidget {
configuration.topUserGuidance.title.text = 'Customized title';
// Configure parameters as needed.
- await startDetector>(
+ await startScanner>(
context: context,
- scannerFunction: () =>
- ScanbotSdkUiV2.startTextPatternScanner(configuration),
+ scannerFunction: () => ScanbotSdk.textPattern.startScanner(configuration),
handleResult: (context, result) async {
- if (result.status == OperationStatus.OK) {
- await Navigator.of(context).push(
- MaterialPageRoute(
+ switch (result) {
+ case Ok():
+ await Navigator.of(context).push(
+ MaterialPageRoute(
builder: (context) =>
- TextPatternScannerUiResultPreview(result.data!)),
- );
- } else {
- await showAlertDialog(
- context, "Operation Status: ${result.status.name}");
+ TextPatternScannerUiResultPreview(result.value),
+ ),
+ );
+ case Error():
+ await showAlertDialog(
+ context,
+ title: "Error",
+ result.error.message,
+ );
+ case Cancel():
+ print("Operation was canceled");
}
},
);
@@ -428,20 +372,26 @@ class DataCaptureUseCases extends StatelessWidget {
configuration.topBar.cancelButton.text = 'Cancel';
// Configure parameters as needed.
- await startDetector>(
+ await startScanner>(
context: context,
- scannerFunction: () =>
- ScanbotSdkUiV2.startCreditCardScanner(configuration),
+ scannerFunction: () => ScanbotSdk.creditCard.startScanner(configuration),
handleResult: (context, result) async {
- if (result.status == OperationStatus.OK) {
- await Navigator.of(context).push(
- MaterialPageRoute(
+ switch (result) {
+ case Ok():
+ await Navigator.of(context).push(
+ MaterialPageRoute(
builder: (context) =>
- CreditCardResultPreview(uiResult: result.data!)),
- );
- } else {
- await showAlertDialog(
- context, "Operation Status: ${result.status.name}");
+ CreditCardResultPreview(uiResult: result.value),
+ ),
+ );
+ case Error():
+ await showAlertDialog(
+ context,
+ title: "Error",
+ result.error.message,
+ );
+ case Cancel():
+ print("Operation was canceled");
}
},
);
@@ -453,19 +403,26 @@ class DataCaptureUseCases extends StatelessWidget {
configuration.introScreen.showAutomatically = true;
// Configure parameters as needed.
- await startDetector>(
+ await startScanner>(
context: context,
- scannerFunction: () => ScanbotSdkUiV2.startMrzScanner(configuration),
+ scannerFunction: () => ScanbotSdk.mrz.startScanner(configuration),
handleResult: (context, result) async {
- if (result.status == OperationStatus.OK) {
- await Navigator.of(context).push(
- MaterialPageRoute(
+ switch (result) {
+ case Ok():
+ await Navigator.of(context).push(
+ MaterialPageRoute(
builder: (context) =>
- MrzDocumentResultPreview(uiResult: result.data!)),
- );
- } else {
- await showAlertDialog(
- context, "Operation Status: ${result.status.name}");
+ MrzDocumentResultPreview(uiResult: result.value),
+ ),
+ );
+ case Error():
+ await showAlertDialog(
+ context,
+ title: "Error",
+ result.error.message,
+ );
+ case Cancel():
+ print("Operation was canceled");
}
},
);
diff --git a/lib/document/document_sdk_menu.dart b/lib/document/document_sdk_menu.dart
index 8a736f7..b8511aa 100644
--- a/lib/document/document_sdk_menu.dart
+++ b/lib/document/document_sdk_menu.dart
@@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
-import 'package:logging/logging.dart';
import 'package:scanbot_sdk/scanbot_sdk.dart';
import '../ui/menu_item_widget.dart';
@@ -17,35 +16,54 @@ class DocumentSdkMenu extends StatelessWidget {
children: [
const DocumentUseCasesWidget(),
const TitleItemWidget(title: 'Other API'),
- MenuItemWidget(title: 'Analyze document quality ', onTap: () => _analyzeDocumentQuality(context)),
- MenuItemWidget(title: 'PerformOCR ', onTap: () => _performOCR(context)),
+ MenuItemWidget(
+ title: 'Analyze document quality',
+ onTap: () => _analyzeDocumentQuality(context),
+ ),
+ MenuItemWidget(
+ title: 'Perform OCR',
+ onTap: () => _performOCR(context),
+ ),
],
),
);
}
Future _analyzeDocumentQuality(BuildContext context) async {
- try {
- final response = await selectImageFromLibrary();
- if (response?.path.isNotEmpty ?? false) {
- var result = await ScanbotSdk.analyzeDocumentQuality(response!.path, DocumentQualityAnalyzerConfiguration());
- await showAlertDialog(context, title: 'Document Quality', result.quality?.name ?? 'Unknown');
- }
- } catch (e) {
- Logger.root.severe(e);
+ final file = await selectImageFromLibrary();
+ if (file == null || file.path.isEmpty) return;
+
+ var result = await ScanbotSdk.document.analyzeQualityOnImageFileUri(
+ file.path,
+ DocumentQualityAnalyzerConfiguration(),
+ );
+ if (result is Ok) {
+ await showAlertDialog(
+ context,
+ title: 'Document Quality',
+ result.value.quality?.name ?? 'Unknown',
+ );
+ } else {
+ print(result.toString());
}
}
Future _performOCR(BuildContext context) async {
- try {
- final response = await selectImageFromLibrary();
- if (response?.path.isNotEmpty ?? false) {
- var result = await ScanbotSdk.performOCR(PerformOCRArguments(imageFileUris: [response!.path]));
- await showAlertDialog(context, title: 'OCR Result', result.plainText);
- }
- } catch (e) {
- Logger.root.severe(e);
+ final file = await selectImageFromLibrary();
+ if (file == null || file.path.isEmpty) return;
+
+ var result = await ScanbotSdk.ocrEngine.recognizeOnImageFileUris([
+ file.path,
+ ]);
+
+ if (result is Ok) {
+ await showAlertDialog(
+ context,
+ title: 'OCR Result',
+ result.value.recognizedText,
+ );
+ } else {
+ print(result.toString());
}
}
}
-
diff --git a/lib/document/document_use_cases.dart b/lib/document/document_use_cases.dart
index 979c3a6..9df7cd1 100644
--- a/lib/document/document_use_cases.dart
+++ b/lib/document/document_use_cases.dart
@@ -1,6 +1,4 @@
import 'package:flutter/material.dart';
-import 'package:image_picker/image_picker.dart';
-import 'package:logging/logging.dart';
import 'package:scanbot_sdk_example_flutter/snippets/document_sdk/multi_page_scanning_snippet.dart';
import 'package:scanbot_sdk_example_flutter/snippets/document_sdk/single_page_scanning_finder_snippet.dart';
import 'package:scanbot_sdk_example_flutter/snippets/document_sdk/single_page_scanning_snippet.dart';
@@ -10,7 +8,6 @@ import '../ui/preview/document_preview.dart';
import '../utility/utils.dart';
import 'package:scanbot_sdk/scanbot_sdk.dart';
-import 'package:scanbot_sdk/scanbot_sdk_ui_v2.dart';
class DocumentUseCasesWidget extends StatelessWidget {
const DocumentUseCasesWidget({Key? key}) : super(key: key);
@@ -20,35 +17,46 @@ class DocumentUseCasesWidget extends StatelessWidget {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- const TitleItemWidget(title: 'Document Scanners (RTU v2.0)'),
- MenuItemWidget(title: 'Single Page Scanning', onTap: () => _startSinglePageScanning(context)),
- MenuItemWidget(title: 'Single Page Scanning with Finder', onTap: () => _startSinglePageWithFinderScanning(context)),
- MenuItemWidget(title: 'Multi Page Scanning with Finder', onTap: () => _startMultiPageScanning(context)),
- MenuItemWidget(title: 'Create Document from Image', onTap: () => _createDocumentFromImage(context)),
- MenuItemWidget(title: 'Clean stored documents', onTap: () => _cleanStoredDocuments(context)),
+ const TitleItemWidget(title: 'Document Scanners (RTU UI)'),
+ MenuItemWidget(
+ title: 'Single Page Scanning',
+ onTap: () => _startSinglePageScanning(context),
+ ),
+ MenuItemWidget(
+ title: 'Single Page Scanning with Finder',
+ onTap: () => _startSinglePageWithFinderScanning(context),
+ ),
+ MenuItemWidget(
+ title: 'Multi Page Scanning with Finder',
+ onTap: () => _startMultiPageScanning(context),
+ ),
+ MenuItemWidget(
+ title: 'Create Document from Image',
+ onTap: () => _createDocumentFromImage(context),
+ ),
+ MenuItemWidget(
+ title: 'Clean stored documents',
+ onTap: () => _cleanStoredDocuments(context),
+ ),
],
);
}
Future startScan({
required BuildContext context,
- required Future> Function() scannerFunction,
+ required Future> Function() scannerFunction,
}) async {
if (!await checkLicenseStatus(context)) {
return;
}
- try {
- var result = await scannerFunction();
- if (result.status == OperationStatus.OK &&
- result.data != null) {
- await Navigator.of(context).push(
- MaterialPageRoute(
- builder: (context) => DocumentPreview(result.data!),
- ),
- );
- }
- } catch (e) {
- print(e);
+
+ var result = await scannerFunction();
+ if (result is Ok) {
+ await Navigator.of(context).push(
+ MaterialPageRoute(builder: (context) => DocumentPreview(result.value)),
+ );
+ } else {
+ print(result.toString());
}
}
@@ -56,7 +64,7 @@ class DocumentUseCasesWidget extends StatelessWidget {
await startScan(
context: context,
scannerFunction: () =>
- ScanbotSdkUiV2.startDocumentScanner(singlePageScanningFlow()),
+ ScanbotSdk.document.startScanner(singlePageScanningFlow()),
);
}
@@ -64,7 +72,7 @@ class DocumentUseCasesWidget extends StatelessWidget {
await startScan(
context: context,
scannerFunction: () =>
- ScanbotSdkUiV2.startDocumentScanner(singlePageWithFinderScanningFlow()),
+ ScanbotSdk.document.startScanner(singlePageWithFinderScanningFlow()),
);
}
@@ -72,37 +80,37 @@ class DocumentUseCasesWidget extends StatelessWidget {
await startScan(
context: context,
scannerFunction: () =>
- ScanbotSdkUiV2.startDocumentScanner(multiPageScanningFlow()),
+ ScanbotSdk.document.startScanner(multiPageScanningFlow()),
);
}
Future _cleanStoredDocuments(BuildContext context) async {
- try {
- await ScanbotSdk.document.deleteAllDocuments();
- await showAlertDialog(context, "Operation status: Success");
- } catch (e) {
- Logger.root.severe(e);
- await showAlertDialog(context, "Operation status: Error\n${e.toString()}");
- }
+ await ScanbotSdk.document.deleteAllDocuments();
+ await showAlertDialog(context, "Operation status: Success");
}
Future _createDocumentFromImage(BuildContext context) async {
- try {
- if (!await checkLicenseStatus(context)) {
- return;
- }
+ if (!await checkLicenseStatus(context)) {
+ return;
+ }
+
+ final file = await selectImageFromLibrary();
+ if (file == null || file.path.isEmpty) return;
- final response = await selectImageFromLibrary();
- if (response?.path.isNotEmpty ?? false) {
- var result = await ScanbotSdk.document.createDocument(CreateDocumentParams(imageFileUris: [response!.path]));
+ await autorelease(() async {
+ var imageRef = ImageRef.fromPath(file.path);
+ var result = await ScanbotSdk.document.createDocumentFromImageRefs(
+ images: [imageRef],
+ );
+ if (result is Ok) {
await Navigator.of(context).push(
MaterialPageRoute(
- builder: (context) => DocumentPreview(result),
+ builder: (context) => DocumentPreview(result.value),
),
);
+ } else {
+ print(result.toString());
}
- } catch (e) {
- Logger.root.severe(e);
- }
+ });
}
}
diff --git a/lib/main.dart b/lib/main.dart
index 1d995d9..06ea4bf 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -1,17 +1,14 @@
import 'dart:async';
import 'dart:convert';
-import 'dart:io';
import 'package:flutter/material.dart';
-import 'package:logging/logging.dart';
import 'package:path_provider/path_provider.dart';
+import 'package:scanbot_sdk_example_flutter/classic_components/document_custom_ui.dart';
-import 'storage/_legacy_pages_repository.dart';
import 'ui/menu_item_widget.dart';
import 'utility/utils.dart';
import 'data_capture/data_capture_sdk_menu.dart';
import 'document/document_sdk_menu.dart';
-import 'classic_components/custom_ui_menu.dart';
import 'package:scanbot_sdk/scanbot_sdk.dart';
@@ -26,61 +23,28 @@ void main() => runApp(MyApp());
const SCANBOT_SDK_LICENSE_KEY = "";
Future _initScanbotSdk() async {
- // Consider adjusting this optional storageBaseDirectory - see the comments below.
- final customStorageBaseDirectory = await getDemoStorageBaseDirectory();
-
- var config = ScanbotSdkConfig(
- loggingEnabled: true,
- // Consider switching logging OFF in production. builds for security and performance reasons.
- licenseKey: SCANBOT_SDK_LICENSE_KEY,
- storageImageFormat: ImageFormat.JPG,
- storageImageQuality: 80,
- // Uncomment to use custom storage directory
- // storageBaseDirectory: customStorageBaseDirectory,
+ var config = SdkConfiguration(
+ loggingEnabled: true,
+ // Consider disabling logging in production builds for security and performance reasons
+ licenseKey: SCANBOT_SDK_LICENSE_KEY,
+ // Uncomment to use the custom storage directory
+ // storageBaseDirectory: await getDemoStorageBaseDirectory(),
);
- if(shouldInitWithEncryption) {
+ if (shouldInitWithEncryption) {
config.fileEncryptionPassword = 'SomeSecretPa\$\$w0rdForFileEncryption';
config.fileEncryptionMode = FileEncryptionMode.AES256;
}
- try {
- await ScanbotSdk.initScanbotSdk(config);
- await LegacyPageRepository().loadPages();
- } catch (e) {
- Logger.root.severe(e);
- }
+ await ScanbotSdk.initialize(config);
}
Future getDemoStorageBaseDirectory() async {
// !! Please note !!
// It is strongly recommended to use the default (secure) storage location of the Scanbot SDK.
- // However, for demo purposes we overwrite the "storageBaseDirectory" of the Scanbot SDK by a custom storage directory.
- //
- // On Android we use the "ExternalStorageDirectory" which is a public(!) folder.
- // All image files and export files (PDF, TIFF, etc) created by the Scanbot SDK in this demo app will be stored
- // in this public storage directory and will be accessible for every(!) app having external storage permissions!
- // Again, this is only for demo purposes, which allows us to easily fetch and check the generated files
- // via Android "adb" CLI tools, Android File Transfer app, Android Studio, etc.
- //
- // On iOS we use the "ApplicationDocumentsDirectory" which is accessible via iTunes file sharing.
- //
- // For more details about the storage system of the Scanbot SDK Flutter Plugin please see our docs:
- // - https://scanbotsdk.github.io/documentation/flutter/
- //
- // For more details about the file system on Android and iOS we also recommend to check out:
- // - https://developer.android.com/guide/topics/data/data-storage
- // - https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/FileSystemOverview/FileSystemOverview.html
-
- Directory storageDirectory;
- if (Platform.isAndroid) {
- storageDirectory = (await getExternalStorageDirectory())!;
- } else if (Platform.isIOS) {
- storageDirectory = await getApplicationDocumentsDirectory();
- } else {
- throw ('Unsupported platform');
- }
+ // However, for demo purposes we overwrite the "storageBaseDirectory" of the Scanbot SDK with a custom storage directory.
+ var storageDirectory = await getApplicationSupportDirectory();
return '${storageDirectory.path}/my-custom-storage';
}
@@ -93,11 +57,6 @@ class MyApp extends StatefulWidget {
}
class _MyAppState extends State {
- @override
- void initState() {
- super.initState();
- }
-
@override
Widget build(BuildContext context) {
return MaterialApp(
@@ -122,11 +81,13 @@ class _MainPageWidgetState extends State {
const TitleItemWidget(title: 'Document SDK API'),
MenuItemWidget(
title: 'Document SDK Menu',
- startIcon: Icons.photo_camera,
+ startIcon: Icons.document_scanner,
endIcon: Icons.arrow_forward,
onTap: () {
Navigator.of(context).push(
- MaterialPageRoute(builder: (context) => const DocumentSdkMenu()),
+ MaterialPageRoute(
+ builder: (context) => const DocumentSdkMenu(),
+ ),
);
},
),
@@ -136,30 +97,34 @@ class _MainPageWidgetState extends State {
endIcon: Icons.arrow_forward,
onTap: () {
Navigator.of(context).push(
- MaterialPageRoute(builder: (context) => const DataCaptureSdkMenu()),
+ MaterialPageRoute(
+ builder: (context) => const DataCaptureSdkMenu(),
+ ),
);
},
),
MenuItemWidget(
- title: 'Custom UI Menu',
+ title: 'Custom UI',
startIcon: Icons.edit,
endIcon: Icons.arrow_forward,
onTap: () {
Navigator.of(context).push(
- MaterialPageRoute(builder: (context) => CustomUiMenu()),
+ MaterialPageRoute(
+ builder: (context) => const DocumentScannerWidget(),
+ ),
);
},
),
const TitleItemWidget(title: 'Other SDK API'),
MenuItemWidget(
- title: 'getLicenseStatus()',
+ title: 'License Info',
startIcon: Icons.phonelink_lock,
onTap: () {
_getLicenseStatus();
},
),
MenuItemWidget(
- title: 'getOcrConfigs()',
+ title: 'Ocr Configs',
startIcon: Icons.settings,
onTap: () {
_getOcrConfigs();
@@ -177,32 +142,32 @@ class _MainPageWidgetState extends State {
),
],
),
- bottomNavigationBar: buildBottomNavigationBar(context)
+ bottomNavigationBar: buildBottomNavigationBar(context),
);
}
Future _getOcrConfigs() async {
- try {
- final result = await ScanbotSdk.getOcrConfigs();
- await showAlertDialog(context, jsonEncode(result), title: 'OCR Configs');
- } catch (e) {
- Logger.root.severe(e);
- await showAlertDialog(context, 'Error getting OCR configs');
+ final result = await ScanbotSdk.getOcrConfigs();
+ if (result is Ok) {
+ await showAlertDialog(
+ context,
+ jsonEncode(result.value),
+ title: 'OCR Configs',
+ );
+ } else {
+ print(result.toString());
}
}
Future _getLicenseStatus() async {
- try {
- final result = await ScanbotSdk.getLicenseStatus();
- var status = " Status: ${result.licenseStatus.name}";
-
- if (result.licenseExpirationDate != null) {
- status += "\n ExpirationDate: ${result.licenseExpirationDate}";
- }
-
- await showAlertDialog(context, status, title: 'License Status');
- } catch (e) {
- await showAlertDialog(context, "Error getting license status", title: "Info");
+ final result = await ScanbotSdk.getLicenseInfo();
+ if (result is Ok) {
+ var licenseInfo = "Status: ${result.value.licenseStatusMessage}\n"
+ "Expiration Date: ${result.value.expirationDateString}";
+
+ await showAlertDialog(context, licenseInfo, title: 'License Status');
+ } else {
+ print(result.toString());
}
}
}
diff --git a/lib/snippets/analytics.dart b/lib/snippets/analytics.dart
index edbd93b..5cac9eb 100644
--- a/lib/snippets/analytics.dart
+++ b/lib/snippets/analytics.dart
@@ -10,4 +10,4 @@ Future analytics() async {
ScanbotSdk.setAnalyticsSubscriber((analyticsEvent) {
Logger.root.log(Level.INFO, analyticsEvent.name);
});
-}
\ No newline at end of file
+}
diff --git a/lib/snippets/classic_components/cropping_widget.dart b/lib/snippets/classic_components/cropping_widget.dart
new file mode 100644
index 0000000..ebb56f3
--- /dev/null
+++ b/lib/snippets/classic_components/cropping_widget.dart
@@ -0,0 +1,22 @@
+import 'package:flutter/material.dart';
+import 'package:scanbot_sdk/scanbot_sdk.dart';
+
+CroppingController? croppingController;
+
+ScanbotCroppingWidget buildCroppingWidget(ImageRef documentImage) {
+ return ScanbotCroppingWidget(
+ documentImage:
+ documentImage, // `ImageRef` document image object to be cropped
+ onViewReady: (controller) {
+ // Callback when the cropping view is ready
+ croppingController = controller;
+ },
+ onHeavyOperationProcessing: (isProcessing) {
+ // Callback for handling long processing operations
+ },
+ edgeColor: Colors.red, // Color of the cropping edges
+ edgeColorOnLine: Colors.blue, // Color when edges are on the line
+ anchorPointsColor: Colors.amberAccent, // Color of anchor points
+ borderInsets: Insets.all(16), // Insets for the cropping borders
+ );
+}
diff --git a/lib/snippets/classic_components/document_scanner_camera.dart b/lib/snippets/classic_components/document_scanner_camera.dart
new file mode 100644
index 0000000..0951f2c
--- /dev/null
+++ b/lib/snippets/classic_components/document_scanner_camera.dart
@@ -0,0 +1,52 @@
+import 'package:flutter/material.dart';
+import 'package:scanbot_sdk/scanbot_sdk.dart';
+
+DocumentScannerCamera buildDocumentScannerCamera() {
+ return DocumentScannerCamera(
+ configuration: DocumentCameraConfiguration(
+ flashEnabled: true, // Manages the initial flash state
+ scannerConfiguration: DocumentClassicScannerConfiguration(
+ autoSnapEnabled: true, // Enable or disable auto-snap
+ detectDocumentAfterSnap: true, // Detect document after snapping
+ autoSnapSensitivity: 0.5, // Sensitivity for auto-snap
+ ),
+ contourConfiguration: ContourConfiguration(
+ showPolygonInManualMode: false, // Hide contour polygon in manual mode
+ strokeOkColor:
+ Colors.red, // Color for contour strokes when detection is OK
+ fillOkColor: Colors.red
+ .withAlpha(150), // Fill color for contours when detection is OK
+ strokeColor: Colors
+ .blue, // Color for contour strokes when detection is in progress
+ fillColor: Colors.blue.withAlpha(
+ 150), // Fill color for contours when detection is in progress
+ cornerRadius: 35, // Radius for contour corners
+ strokeWidth: 10, // Width of contour strokes
+ autoSnapProgressStrokeColor:
+ Colors.greenAccent, // Color for auto-snap progress
+ autoSnapProgressEnabled: true, // Enable auto-snap progress indicator
+ autoSnapProgressStrokeWidth:
+ 5, // Width of the auto-snap progress stroke
+ ),
+ ),
+ onSnappedDocumentResult: (
+ ImageRef originalImage,
+ ImageRef? documentImage,
+ DocumentDetectionResult? detectionResult,
+ ) async {
+ // Handle the original image and, if detectDocumentAfterSnap is enabled, the cropped image of the detected document along with the document detection result.
+ },
+ onError: (error) {
+ // Handle errors such as licensing issues or camera errors
+ },
+ onFrameDetectionResult: (result) {
+ // Handle document detection results
+ },
+ onCameraPreviewStarted: (isFlashAvailable) {
+ // Perform any setup after the camera preview starts
+ },
+ onHeavyOperationProcessing: (show) {
+ // Display a progress bar or loading indicator during long operations
+ },
+ );
+}
diff --git a/lib/snippets/data_capture_sdk/image_recognizers/recognize_check_on_image.dart b/lib/snippets/data_capture_sdk/image_recognizers/recognize_check_on_image.dart
index 4a39f2b..c20335d 100644
--- a/lib/snippets/data_capture_sdk/image_recognizers/recognize_check_on_image.dart
+++ b/lib/snippets/data_capture_sdk/image_recognizers/recognize_check_on_image.dart
@@ -2,15 +2,22 @@ import 'package:scanbot_sdk/scanbot_sdk.dart';
Future recognizeCheckOnImage(String uriPath) async {
var configuration = CheckScannerConfiguration();
- configuration.documentDetectionMode = CheckDocumentDetectionMode.DETECT_DOCUMENT;
+ configuration.documentDetectionMode =
+ CheckDocumentDetectionMode.DETECT_DOCUMENT;
// Configure other parameters as needed.
- CheckScanningResult result = await ScanbotSdk.recognizeOperations.recognizeCheckOnImage(uriPath, configuration);
- if (result.status == CheckMagneticInkStripScanningStatus.SUCCESS) {
- // ...
+ var result = await ScanbotSdk.check.scanFromImageFileUri(
+ uriPath,
+ configuration,
+ );
+ if (result is Ok &&
+ result.value.status == CheckMagneticInkStripScanningStatus.SUCCESS) {
+ /** Handle the result **/
+ } else {
+ print(result.toString());
}
}
String formatCheckResult(CheckScanningResult result) {
- return "CheckType FullName: ${result.check?.type.fullName}";
-}
\ No newline at end of file
+ return "CheckType FullName: ${result.check?.type.fullName}";
+}
diff --git a/lib/snippets/data_capture_sdk/image_recognizers/recognize_credit_card_on_image.dart b/lib/snippets/data_capture_sdk/image_recognizers/recognize_credit_card_on_image.dart
index 6f079f0..5a07775 100644
--- a/lib/snippets/data_capture_sdk/image_recognizers/recognize_credit_card_on_image.dart
+++ b/lib/snippets/data_capture_sdk/image_recognizers/recognize_credit_card_on_image.dart
@@ -5,12 +5,18 @@ Future recognizeCreditCardOnImage(String uriPath) async {
configuration.requireCardholderName = true;
// Configure other parameters as needed.
- CreditCardScanningResult result = await ScanbotSdk.recognizeOperations.recognizeCreditCardOnImage(uriPath, configuration);
- if (result.scanningStatus == CreditCardScanningStatus.SUCCESS) {
- // ...
+ var result = await ScanbotSdk.creditCard.scanFromImageFileUri(
+ uriPath,
+ configuration,
+ );
+ if (result is Ok &&
+ result.value.scanningStatus == CreditCardScanningStatus.SUCCESS) {
+ /** Handle the result **/
+ } else {
+ print(result.toString());
}
}
String formatCheckResult(CreditCardScanningResult result) {
return "CreditCard Type: ${result.creditCard?.type.fullName}";
-}
\ No newline at end of file
+}
diff --git a/lib/snippets/data_capture_sdk/image_recognizers/recognize_document_data_on_image.dart b/lib/snippets/data_capture_sdk/image_recognizers/recognize_document_data_on_image.dart
index 76d7085..cbee6f0 100644
--- a/lib/snippets/data_capture_sdk/image_recognizers/recognize_document_data_on_image.dart
+++ b/lib/snippets/data_capture_sdk/image_recognizers/recognize_document_data_on_image.dart
@@ -1,7 +1,8 @@
import 'package:scanbot_sdk/scanbot_sdk.dart';
Future extractDocumentData(String uriPath) async {
- var commonConfig = DocumentDataExtractorCommonConfiguration(acceptedDocumentTypes: [
+ var commonConfig = DocumentDataExtractorCommonConfiguration(
+ acceptedDocumentTypes: [
DeIdCardFront.DOCUMENT_TYPE,
DeIdCardBack.DOCUMENT_TYPE,
DeHealthInsuranceCardFront.DOCUMENT_TYPE,
@@ -11,19 +12,26 @@ Future extractDocumentData(String uriPath) async {
EuropeanHealthInsuranceCard.DOCUMENT_TYPE,
EuropeanDriverLicenseFront.DOCUMENT_TYPE,
EuropeanDriverLicenseBack.DOCUMENT_TYPE,
- ]);
+ ],
+ );
- var configuration = DocumentDataExtractorConfiguration(
- configurations: [commonConfig],
- );
- // Configure other parameters as needed.
+ var configuration = DocumentDataExtractorConfiguration(
+ configurations: [commonConfig],
+ );
+ // Configure other parameters as needed.
- DocumentDataExtractionResult result = await ScanbotSdk.recognizeOperations.extractDocumentDataFromImage(uriPath, configuration);
- if (result.status == DocumentDataExtractionStatus.SUCCESS) {
- // ...
+ var result = await ScanbotSdk.documentDataExtractor.extractFromImageFileUri(
+ uriPath,
+ configuration,
+ );
+ if (result is Ok &&
+ result.value.status == DocumentDataExtractionStatus.OK) {
+ /** Handle the result **/
+ } else {
+ print(result.toString());
}
}
String formatGenericDocumentResult(DocumentDataExtractionResult result) {
- return "DocumentType: ${result.document?.type.fullName}";
-}
\ No newline at end of file
+ return "DocumentType: ${result.document?.type.fullName}";
+}
diff --git a/lib/snippets/data_capture_sdk/image_recognizers/recognize_ehic_on_image.dart b/lib/snippets/data_capture_sdk/image_recognizers/recognize_ehic_on_image.dart
deleted file mode 100644
index e53f5c2..0000000
--- a/lib/snippets/data_capture_sdk/image_recognizers/recognize_ehic_on_image.dart
+++ /dev/null
@@ -1,18 +0,0 @@
-import 'package:scanbot_sdk/scanbot_sdk.dart';
-
-Future _recognizeEhicOnImage(String uriPath) async {
- var configuration = EuropeanHealthInsuranceCardRecognizerConfiguration();
- configuration.maxExpirationYear = 2100;
- // Configure other parameters as needed.
-
- EuropeanHealthInsuranceCardRecognitionResult result = await ScanbotSdk.recognizeOperations.recognizeHealthInsuranceCardOnImage(uriPath, configuration);
- if (result.status == EuropeanHealthInsuranceCardRecognitionResultRecognitionStatus.SUCCESS) {
- // ...
- }
-}
-String formatHealthInsuranceCardResult(EuropeanHealthInsuranceCardRecognitionResult result) {
- return '''
-EHIC first field: ${result.fields.first.type}
-Value: ${result.fields.first.value}"
-''';
-}
\ No newline at end of file
diff --git a/lib/snippets/data_capture_sdk/image_recognizers/recognize_medical_certificate_on_image.dart b/lib/snippets/data_capture_sdk/image_recognizers/recognize_medical_certificate_on_image.dart
deleted file mode 100644
index ddba6bf..0000000
--- a/lib/snippets/data_capture_sdk/image_recognizers/recognize_medical_certificate_on_image.dart
+++ /dev/null
@@ -1,18 +0,0 @@
-import 'package:scanbot_sdk/scanbot_sdk.dart';
-
-Future recognizeMedicalDocumentOnImage(String uriPath) async {
- var configuration = MedicalCertificateScanningParameters();
- configuration.recognizePatientInfoBox = true;
- // Configure other parameters as needed.
-
- MedicalCertificateScanningResult result = await ScanbotSdk.recognizeOperations.recognizeMedicalCertificateOnImage(uriPath, configuration);
- if (result.scanningSuccessful) {
- // ...
- }
-}
-
-String formatMedicalCertificateResult(MedicalCertificateScanningResult result) {
- return '''
-mcFormType: ${result.formType.name}
-''';
-}
\ No newline at end of file
diff --git a/lib/snippets/data_capture_sdk/image_recognizers/recognize_mrz_on_image.dart b/lib/snippets/data_capture_sdk/image_recognizers/recognize_mrz_on_image.dart
index b335ce0..b894fb4 100644
--- a/lib/snippets/data_capture_sdk/image_recognizers/recognize_mrz_on_image.dart
+++ b/lib/snippets/data_capture_sdk/image_recognizers/recognize_mrz_on_image.dart
@@ -1,20 +1,24 @@
import 'package:scanbot_sdk/scanbot_sdk.dart';
-Future _recognizeMrzDocumentOnImage(String uriPath) async {
- var configuration = MrzScannerConfiguration();
+Future recognizeMrzDocumentOnImage(String uriPath) async {
+ var configuration = MrzScannerConfiguration();
configuration.incompleteResultHandling = MrzIncompleteResultHandling.REJECT;
// Configure other parameters as needed.
- var result = await ScanbotSdk.recognizeOperations.recognizeMrzOnImage(uriPath, configuration);
- if (result.success) {
- // ...
+ var result = await ScanbotSdk.mrz.scanFromImageFileUri(
+ uriPath,
+ configuration,
+ );
+ if (result is Ok && result.value.success) {
+ /** Handle the result **/
+ } else {
+ print(result.toString());
}
}
String formatMrzResult(MrzScannerResult result) {
- return '''
+ return '''
Document: ${result.document?.type.name}
rawMrz: ${result.rawMRZ}
''';
-
-}
\ No newline at end of file
+}
diff --git a/lib/snippets/data_capture_sdk/rtu_data_detectors/rtu_check_scanner.dart b/lib/snippets/data_capture_sdk/rtu_data_detectors/rtu_check_scanner.dart
index cc9058b..2f11c6d 100644
--- a/lib/snippets/data_capture_sdk/rtu_data_detectors/rtu_check_scanner.dart
+++ b/lib/snippets/data_capture_sdk/rtu_data_detectors/rtu_check_scanner.dart
@@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
-import 'package:scanbot_sdk/scanbot_sdk_ui_v2.dart';
+import 'package:scanbot_sdk/scanbot_sdk.dart';
import 'package:scanbot_sdk_example_flutter/ui/preview/check_preview.dart';
import '../../../utility/utils.dart';
@@ -20,36 +20,37 @@ class RtuCheckScannerFeature extends StatelessWidget {
final isLicenseValid = await checkLicenseStatus(context);
if (!isLicenseValid) return;
- try {
- var config = CheckScannerScreenConfiguration();
- // Configure the strings.
- config.localization.topUserGuidance = 'Localized topUserGuidance';
- config.localization.cameraPermissionCloseButton = 'Localized cameraPermissionCloseButton';
- config.localization.completionOverlaySuccessMessage = 'Localized completionOverlaySuccessMessage';
- config.localization.introScreenText = 'Localized introScreenText';
- // Configure other parameters as needed.
-
- // An autorelease pool is required only because the result object contains image references.
- await autorelease(() async {
- var result = await ScanbotSdkUiV2.startCheckScanner(config);
-
- if (result.status == OperationStatus.OK && result.data?.check != null) {
-
- /// if you want to use image later, call encodeImages() to save in buffer
+ var config = CheckScannerScreenConfiguration();
+ // Configure the strings.
+ config.localization.topUserGuidance = 'Localized topUserGuidance';
+ config.localization.cameraPermissionCloseButton =
+ 'Localized cameraPermissionCloseButton';
+ config.localization.completionOverlaySuccessMessage =
+ 'Localized completionOverlaySuccessMessage';
+ config.localization.introScreenText = 'Localized introScreenText';
+ // Configure other parameters as needed.
+
+ // An autorelease pool is required only because the result object contains image references.
+ await autorelease(() async {
+ var result = await ScanbotSdk.check.startScanner(config);
+ switch (result) {
+ case Ok():
+
+ /// if the image needs to be used later, call encodeImages() to save in buffer
// result.data?.encodeImages();
await Navigator.push(
context,
MaterialPageRoute(
- builder: (_) => CheckDocumentResultPreview(
- uiResult: result.data,
- ),
+ builder: (_) =>
+ CheckDocumentResultPreview(uiResult: result.value),
),
);
- }
- });
- } catch (e) {
- showAlertDialog(context, 'Error: ${e.toString()}');
- }
+ case Error():
+ await showAlertDialog(context, title: "Error", result.error.message);
+ case Cancel():
+ print("Operation was canceled");
+ }
+ });
}
}
diff --git a/lib/snippets/data_capture_sdk/rtu_data_detectors/rtu_credit_card_scanner.dart b/lib/snippets/data_capture_sdk/rtu_data_detectors/rtu_credit_card_scanner.dart
index e5e69b0..0870f8f 100644
--- a/lib/snippets/data_capture_sdk/rtu_data_detectors/rtu_credit_card_scanner.dart
+++ b/lib/snippets/data_capture_sdk/rtu_data_detectors/rtu_credit_card_scanner.dart
@@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
-import 'package:scanbot_sdk/scanbot_sdk_ui_v2.dart';
+import 'package:scanbot_sdk/scanbot_sdk.dart';
import 'package:scanbot_sdk_example_flutter/ui/preview/credit_card_preview.dart';
import '../../../utility/utils.dart';
@@ -20,38 +20,36 @@ class RtuCreditCardScannerFeature extends StatelessWidget {
final isLicenseValid = await checkLicenseStatus(context);
if (!isLicenseValid) return;
- try {
- var config = CreditCardScannerScreenConfiguration();
- // Configure the top bar mode
- config.topBar.mode = TopBarMode.GRADIENT;
- // Configure the top bar status bar mode
- config.topBar.statusBarMode = StatusBarMode.LIGHT;
- // Configure the top bar background color
- config.topBar.cancelButton.text = 'Cancel';
- // Configure parameters as needed.
+ var config = CreditCardScannerScreenConfiguration();
+ // Configure the top bar mode
+ config.topBar.mode = TopBarMode.GRADIENT;
+ // Configure the top bar status bar mode
+ config.topBar.statusBarMode = StatusBarMode.LIGHT;
+ // Configure the top bar background color
+ config.topBar.cancelButton.text = 'Cancel';
+ // Configure parameters as needed.
- // An autorelease pool is required only because the result object contains image references.
- await autorelease(() async {
- var result = await ScanbotSdkUiV2.startCreditCardScanner(config);
+ // An autorelease pool is required only because the result object contains image references.
+ await autorelease(() async {
+ var result = await ScanbotSdk.creditCard.startScanner(config);
- if (result.status == OperationStatus.OK && result.data?.creditCard != null) {
+ switch (result) {
+ case Ok():
- /// if you want to use image later, call encodeImages() to save in buffer
+ /// if the image needs to be used later, call encodeImages() to save in buffer
// result.data?.encodeImages();
await Navigator.push(
context,
MaterialPageRoute(
- builder: (_) => CreditCardResultPreview(
- uiResult: result.data,
- ),
-
+ builder: (_) => CreditCardResultPreview(uiResult: result.value),
),
);
- }
- });
- } catch (e) {
- showAlertDialog(context, 'Error: ${e.toString()}');
- }
+ case Error():
+ await showAlertDialog(context, title: "Error", result.error.message);
+ case Cancel():
+ print("Operation was canceled");
+ }
+ });
}
}
diff --git a/lib/snippets/data_capture_sdk/rtu_data_detectors/rtu_document_data_extractor.dart b/lib/snippets/data_capture_sdk/rtu_data_detectors/rtu_document_data_extractor.dart
index b87c1df..5410c92 100644
--- a/lib/snippets/data_capture_sdk/rtu_data_detectors/rtu_document_data_extractor.dart
+++ b/lib/snippets/data_capture_sdk/rtu_data_detectors/rtu_document_data_extractor.dart
@@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
-import 'package:scanbot_sdk/scanbot_sdk_ui_v2.dart';
+import 'package:scanbot_sdk/scanbot_sdk.dart';
import '../../../ui/preview/extracted_document_data_preview.dart';
import '../../../utility/utils.dart';
@@ -20,32 +20,33 @@ class RtuDocumentDataExtractorFeature extends StatelessWidget {
final isLicenseValid = await checkLicenseStatus(context);
if (!isLicenseValid) return;
- try {
- var config = DocumentDataExtractorScreenConfiguration();
- config.viewFinder.overlayColor = ScanbotColor('#C8193C');
- // Configure other parameters as needed.
+ var config = DocumentDataExtractorScreenConfiguration();
+ config.viewFinder.overlayColor = ScanbotColor('#C8193C');
+ // Configure other parameters as needed.
- // An autorelease pool is required only because the result object contains image references.
- await autorelease(() async {
- var result = await ScanbotSdkUiV2.startDocumentDataExtractor(config);
+ // An autorelease pool is required only because the result object contains image references.
+ await autorelease(() async {
+ var result = await ScanbotSdk.documentDataExtractor.startExtractorScreen(
+ config,
+ );
+ switch (result) {
+ case Ok():
- if (result.status == OperationStatus.OK && result.data?.document != null) {
-
- /// if you want to use image later, call encodeImages() to save in buffer
+ /// if the image needs to be used later, call encodeImages() to save in buffer
// result.data?.encodeImages();
await Navigator.push(
context,
MaterialPageRoute(
- builder: (_) => ExtractedDocumentDataPreview(
- uiResult: result.data,
- ),
+ builder: (_) =>
+ ExtractedDocumentDataPreview(uiResult: result.value),
),
);
- }
- });
- } catch (e) {
- showAlertDialog(context, 'Error: ${e.toString()}');
- }
+ case Error():
+ await showAlertDialog(context, title: "Error", result.error.message);
+ case Cancel():
+ print("Operation was canceled");
+ }
+ });
}
}
diff --git a/lib/snippets/data_capture_sdk/rtu_data_detectors/rtu_mrz_scanner.dart b/lib/snippets/data_capture_sdk/rtu_data_detectors/rtu_mrz_scanner.dart
index 8c049b9..477dbb8 100644
--- a/lib/snippets/data_capture_sdk/rtu_data_detectors/rtu_mrz_scanner.dart
+++ b/lib/snippets/data_capture_sdk/rtu_data_detectors/rtu_mrz_scanner.dart
@@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
-import 'package:scanbot_sdk/scanbot_sdk_ui_v2.dart';
+import 'package:scanbot_sdk/scanbot_sdk.dart';
import '../../../ui/preview/mrz_document_preview.dart';
import '../../../utility/utils.dart';
@@ -20,45 +20,45 @@ class RtuMrzScannerFeature extends StatelessWidget {
final isLicenseValid = await checkLicenseStatus(context);
if (!isLicenseValid) return;
- try {
- var config = MrzScannerScreenConfiguration();
+ var config = MrzScannerScreenConfiguration();
- // Set colors
- config.palette.sbColorPrimary = ScanbotColor('#C8193C');
- config.palette.sbColorOnPrimary = ScanbotColor('#ffffff');
+ // Set colors
+ config.palette.sbColorPrimary = ScanbotColor('#C8193C');
+ config.palette.sbColorOnPrimary = ScanbotColor('#ffffff');
- // Add a top guidance title
- config.topUserGuidance.title = StyledText(
- text: 'Scan MRZ',
- color: ScanbotColor('#C8193C'),
- useShadow: true,
- );
+ // Add a top guidance title
+ config.topUserGuidance.title = StyledText(
+ text: 'Scan MRZ',
+ color: ScanbotColor('#C8193C'),
+ useShadow: true,
+ );
- // Modify the action bar
- config.actionBar.flipCameraButton.visible = false;
- config.actionBar.flashButton.activeForegroundColor =
- ScanbotColor('#C8193C');
+ // Modify the action bar
+ config.actionBar.flipCameraButton.visible = false;
+ config.actionBar.flashButton.activeForegroundColor = ScanbotColor(
+ '#C8193C',
+ );
- // Configure the scanner
- config.scannerConfiguration.incompleteResultHandling =
- MrzIncompleteResultHandling.ACCEPT;
+ // Configure the scanner
+ config.scannerConfiguration.incompleteResultHandling =
+ MrzIncompleteResultHandling.ACCEPT;
- // Configure other parameters as needed.
- final result = await ScanbotSdkUiV2.startMrzScanner(config);
+ // Configure other parameters as needed.
+ final result = await ScanbotSdk.mrz.startScanner(config);
+ switch (result) {
+ case Ok():
- if (result.status == OperationStatus.OK && result.data?.mrzDocument != null) {
// Always serialize the MRZ document before stringifying, and use the serialized result.
await Navigator.push(
context,
MaterialPageRoute(
- builder: (_) => MrzDocumentResultPreview(
- uiResult: result.data,
- ),
+ builder: (_) => MrzDocumentResultPreview(uiResult: result.value),
),
);
- }
- } catch (e) {
- showAlertDialog(context, 'Error: ${e.toString()}');
+ case Error():
+ await showAlertDialog(context, title: "Error", result.error.message);
+ case Cancel():
+ print("Operation was canceled");
}
}
}
diff --git a/lib/snippets/data_capture_sdk/rtu_data_detectors/rtu_text_pattern_scanner.dart b/lib/snippets/data_capture_sdk/rtu_data_detectors/rtu_text_pattern_scanner.dart
index 4e34bcc..19a7d0a 100644
--- a/lib/snippets/data_capture_sdk/rtu_data_detectors/rtu_text_pattern_scanner.dart
+++ b/lib/snippets/data_capture_sdk/rtu_data_detectors/rtu_text_pattern_scanner.dart
@@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
-import 'package:scanbot_sdk/scanbot_sdk_ui_v2.dart';
+import 'package:scanbot_sdk/scanbot_sdk.dart';
import '../../../ui/preview/text_pattern_preview.dart';
import '../../../utility/utils.dart';
@@ -20,26 +20,26 @@ class RtuTextPatternScannerFeature extends StatelessWidget {
final isLicenseValid = await checkLicenseStatus(context);
if (!isLicenseValid) return;
- try {
- var config = TextPatternScannerScreenConfiguration();
- // Show the top user guidance
- config.topUserGuidance.visible = true;
- // Customize the top user guidance
- config.topUserGuidance.title.text = 'Customized title';
- // Configure parameters as needed.
+ var config = TextPatternScannerScreenConfiguration();
+ // Show the top user guidance
+ config.topUserGuidance.visible = true;
+ // Customize the top user guidance
+ config.topUserGuidance.title.text = 'Customized title';
+ // Configure parameters as needed.
- var result = await ScanbotSdkUiV2.startTextPatternScanner(config);
-
- if (result.status == OperationStatus.OK && result.data != null) {
+ var result = await ScanbotSdk.textPattern.startScanner(config);
+ switch (result) {
+ case Ok():
await Navigator.push(
context,
MaterialPageRoute(
- builder: (_) => TextPatternScannerUiResultPreview(result.data!),
+ builder: (_) => TextPatternScannerUiResultPreview(result.value),
),
);
- }
- } catch (e) {
- showAlertDialog(context, 'Error: ${e.toString()}');
+ case Error():
+ await showAlertDialog(context, title: "Error", result.error.message);
+ case Cancel():
+ print("Operation was canceled");
}
}
}
diff --git a/lib/snippets/data_capture_sdk/rtu_data_detectors/rtu_vin_scanner.dart b/lib/snippets/data_capture_sdk/rtu_data_detectors/rtu_vin_scanner.dart
index ec14cba..4c3fbf9 100644
--- a/lib/snippets/data_capture_sdk/rtu_data_detectors/rtu_vin_scanner.dart
+++ b/lib/snippets/data_capture_sdk/rtu_data_detectors/rtu_vin_scanner.dart
@@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
-import 'package:scanbot_sdk/scanbot_sdk_ui_v2.dart';
+import 'package:scanbot_sdk/scanbot_sdk.dart';
import '../../../ui/preview/vin_preview.dart';
import '../../../utility/utils.dart';
@@ -20,31 +20,31 @@ class RtuVinScannerFeature extends StatelessWidget {
final isLicenseValid = await checkLicenseStatus(context);
if (!isLicenseValid) return;
- try {
- var config = VinScannerScreenConfiguration();
- config.introScreen.explanation.text =
- 'Quickly and securely scan the VIN by holding your device over the vehicle identification number or vehicle identification barcode' +
- '\\nThe scanner will guide you to the optimal scanning position.' +
- 'Once the scan is complete, your VIN details will automatically be extracted and processed.';
- // Configure the done button. E.g., the text or the background color.
- config.introScreen.doneButton.text = 'Start Scanning';
- config.introScreen.doneButton.background.fillColor = ScanbotColor('#C8193C');
- // Configure other parameters as needed.
-
- var result = await ScanbotSdkUiV2.startVINScanner(config);
+ var config = VinScannerScreenConfiguration();
+ config.introScreen.explanation.text =
+ 'Quickly and securely scan the VIN by holding your device over the vehicle identification number or vehicle identification barcode'
+ '\\nThe scanner will guide you to the optimal scanning position.'
+ 'Once the scan is complete, your VIN details will automatically be extracted and processed.';
+ // Configure the done button. E.g., the text or the background color.
+ config.introScreen.doneButton.text = 'Start Scanning';
+ config.introScreen.doneButton.background.fillColor = ScanbotColor(
+ '#C8193C',
+ );
+ // Configure other parameters as needed.
- if (result.status == OperationStatus.OK && result.data != null) {
+ var result = await ScanbotSdk.vin.startScanner(config);
+ switch (result) {
+ case Ok():
await Navigator.push(
context,
MaterialPageRoute(
- builder: (_) => VinScannerResultPreview(
- uiResult: result.data,
- ),
+ builder: (_) => VinScannerResultPreview(uiResult: result.value),
),
);
- }
- } catch (e) {
- showAlertDialog(context, 'Error: ${e.toString()}');
+ case Error():
+ await showAlertDialog(context, title: "Error", result.error.message);
+ case Cancel():
+ print("Operation was canceled");
}
}
}
diff --git a/lib/snippets/data_capture_sdk/rtuui_check/action_bar.dart b/lib/snippets/data_capture_sdk/rtuui_check/action_bar.dart
index 0341774..0c1f03d 100644
--- a/lib/snippets/data_capture_sdk/rtuui_check/action_bar.dart
+++ b/lib/snippets/data_capture_sdk/rtuui_check/action_bar.dart
@@ -1,4 +1,4 @@
-import 'package:scanbot_sdk/scanbot_sdk_ui_v2.dart';
+import 'package:scanbot_sdk/scanbot_sdk.dart';
Future startScanning() async {
// Create an instance of the default configuration
@@ -14,8 +14,13 @@ Future startScanning() async {
// Hide the flip camera button
configuration.actionBar.flipCameraButton.visible = false;
// Start the Check Scanner
- var result = await ScanbotSdkUiV2.startCheckScanner(configuration);
- if (result.status == OperationStatus.OK) {
- // ...
+ var result = await ScanbotSdk.check.startScanner(configuration);
+
+ if (result is Ok) {
+ /** Handle the result **/
+ var scannerUiResult = result.value;
+ print(scannerUiResult.toString());
+ } else {
+ print(result.toString());
}
-}
\ No newline at end of file
+}
diff --git a/lib/snippets/data_capture_sdk/rtuui_check/finder_overlay.dart b/lib/snippets/data_capture_sdk/rtuui_check/finder_overlay.dart
index b23074a..431d22d 100644
--- a/lib/snippets/data_capture_sdk/rtuui_check/finder_overlay.dart
+++ b/lib/snippets/data_capture_sdk/rtuui_check/finder_overlay.dart
@@ -1,4 +1,4 @@
-import 'package:scanbot_sdk/scanbot_sdk_ui_v2.dart';
+import 'package:scanbot_sdk/scanbot_sdk.dart';
Future startScanning() async {
// Create an instance of the default configuration
@@ -6,18 +6,19 @@ Future startScanning() async {
// Set the overlay color
configuration.viewFinder.overlayColor = ScanbotColor('#C8193C');
// Configure the aspect ratio of the view finder
- configuration.viewFinder.aspectRatio = AspectRatio(
- width: 8,
- height: 6,
- );
+ configuration.viewFinder.aspectRatio = AspectRatio(width: 8, height: 6);
// Configure the view finder style
configuration.viewFinder.style = FinderCorneredStyle(
cornerRadius: 8,
strokeWidth: 2,
);
// Start the Check Scanner
- var result = await ScanbotSdkUiV2.startCheckScanner(configuration);
- if (result.status == OperationStatus.OK) {
- // ...
+ var result = await ScanbotSdk.check.startScanner(configuration);
+ if (result is Ok) {
+ /** Handle the result **/
+ var scannerUiResult = result.value;
+ print(scannerUiResult.toString());
+ } else {
+ print(result.toString());
}
-}
\ No newline at end of file
+}
diff --git a/lib/snippets/data_capture_sdk/rtuui_check/introduction_screen.dart b/lib/snippets/data_capture_sdk/rtuui_check/introduction_screen.dart
index 90cf389..a03bc17 100644
--- a/lib/snippets/data_capture_sdk/rtuui_check/introduction_screen.dart
+++ b/lib/snippets/data_capture_sdk/rtuui_check/introduction_screen.dart
@@ -1,4 +1,4 @@
-import 'package:scanbot_sdk/scanbot_sdk_ui_v2.dart';
+import 'package:scanbot_sdk/scanbot_sdk.dart';
Future startScanning() async {
// Create an instance of the default configuration
@@ -11,21 +11,25 @@ Future startScanning() async {
text: 'Check Scanner',
);
// Configure the image for the introduction screen.
- configuration.introScreen.image = CheckIntroCustomImage(
- uri: 'imageUri',
- );
+ configuration.introScreen.image = CheckIntroCustomImage(uri: 'imageUri');
// Configure the text.
configuration.introScreen.explanation.color = ScanbotColor('#000000');
configuration.introScreen.explanation.text =
- 'Quickly and securely scan your checks by holding your device over the check' +
- '\\nThe scanner will guide you to the optimal scanning position.' +
- 'Once the scan is complete, your check details will automatically be extracted and processed.';
+ 'Quickly and securely scan your checks by holding your device over the check'
+ '\\nThe scanner will guide you to the optimal scanning position.'
+ 'Once the scan is complete, your check details will automatically be extracted and processed.';
// Configure the done button. E.g., the text or the background color.
configuration.introScreen.doneButton.text = 'Start Scanning';
- configuration.introScreen.doneButton.background.fillColor = ScanbotColor('#C8193C');
+ configuration.introScreen.doneButton.background.fillColor = ScanbotColor(
+ '#C8193C',
+ );
// Start the Check Scanner UI
- var result = await ScanbotSdkUiV2.startCheckScanner(configuration);
- if (result.status == OperationStatus.OK) {
- // ...
+ var result = await ScanbotSdk.check.startScanner(configuration);
+ if (result is Ok) {
+ /** Handle the result **/
+ var scannerUiResult = result.value;
+ print(scannerUiResult.toString());
+ } else {
+ print(result.toString());
}
-}
\ No newline at end of file
+}
diff --git a/lib/snippets/data_capture_sdk/rtuui_check/launching_the_scanner.dart b/lib/snippets/data_capture_sdk/rtuui_check/launching_the_scanner.dart
index ecc386b..8207f70 100644
--- a/lib/snippets/data_capture_sdk/rtuui_check/launching_the_scanner.dart
+++ b/lib/snippets/data_capture_sdk/rtuui_check/launching_the_scanner.dart
@@ -1,11 +1,15 @@
-import 'package:scanbot_sdk/scanbot_sdk_ui_v2.dart';
+import 'package:scanbot_sdk/scanbot_sdk.dart';
Future startScanning() async {
// Create an instance of the default configuration
var configuration = CheckScannerScreenConfiguration();
// Start the Check Scanner
- var result = await ScanbotSdkUiV2.startCheckScanner(configuration);
- if (result.status == OperationStatus.OK) {
- // ...
+ var result = await ScanbotSdk.check.startScanner(configuration);
+ if (result is Ok) {
+ /** Handle the result **/
+ var scannerUiResult = result.value;
+ print(scannerUiResult.toString());
+ } else {
+ print(result.toString());
}
-}
\ No newline at end of file
+}
diff --git a/lib/snippets/data_capture_sdk/rtuui_check/localization.dart b/lib/snippets/data_capture_sdk/rtuui_check/localization.dart
index fae67ef..0a47ee3 100644
--- a/lib/snippets/data_capture_sdk/rtuui_check/localization.dart
+++ b/lib/snippets/data_capture_sdk/rtuui_check/localization.dart
@@ -1,16 +1,22 @@
-import 'package:scanbot_sdk/scanbot_sdk_ui_v2.dart';
+import 'package:scanbot_sdk/scanbot_sdk.dart';
Future startScanning() async {
// Create an instance of the default configuration
var configuration = CheckScannerScreenConfiguration();
// Configure the strings.
configuration.localization.topUserGuidance = 'Localized topUserGuidance';
- configuration.localization.cameraPermissionCloseButton = 'Localized cameraPermissionCloseButton';
- configuration.localization.completionOverlaySuccessMessage = 'Localized completionOverlaySuccessMessage';
+ configuration.localization.cameraPermissionCloseButton =
+ 'Localized cameraPermissionCloseButton';
+ configuration.localization.completionOverlaySuccessMessage =
+ 'Localized completionOverlaySuccessMessage';
configuration.localization.introScreenText = 'Localized introScreenText';
// Start the Check Scanner UI
- var result = await ScanbotSdkUiV2.startCheckScanner(configuration);
- if (result.status == OperationStatus.OK) {
- // ...
+ var result = await ScanbotSdk.check.startScanner(configuration);
+ if (result is Ok) {
+ /** Handle the result **/
+ var scannerUiResult = result.value;
+ print(scannerUiResult.toString());
+ } else {
+ print(result.toString());
}
-}
\ No newline at end of file
+}
diff --git a/lib/snippets/data_capture_sdk/rtuui_check/palette.dart b/lib/snippets/data_capture_sdk/rtuui_check/palette.dart
index 3ac57ed..7b75526 100644
--- a/lib/snippets/data_capture_sdk/rtuui_check/palette.dart
+++ b/lib/snippets/data_capture_sdk/rtuui_check/palette.dart
@@ -1,4 +1,4 @@
-import 'package:scanbot_sdk/scanbot_sdk_ui_v2.dart';
+import 'package:scanbot_sdk/scanbot_sdk.dart';
Future startScanning() async {
// Create an instance of the default configuration
@@ -23,8 +23,12 @@ Future startScanning() async {
palette.sbColorSurfaceHigh = ScanbotColor('#7A000000');
palette.sbColorModalOverlay = ScanbotColor('#A3000000');
// Start the Check Scanner UI
- var result = await ScanbotSdkUiV2.startCheckScanner(configuration);
- if (result.status == OperationStatus.OK) {
- // ...
+ var result = await ScanbotSdk.check.startScanner(configuration);
+ if (result is Ok) {
+ /** Handle the result **/
+ var scannerUiResult = result.value;
+ print(scannerUiResult.toString());
+ } else {
+ print(result.toString());
}
-}
\ No newline at end of file
+}
diff --git a/lib/snippets/data_capture_sdk/rtuui_check/top_bar.dart b/lib/snippets/data_capture_sdk/rtuui_check/top_bar.dart
index a2d20f3..3e7b32f 100644
--- a/lib/snippets/data_capture_sdk/rtuui_check/top_bar.dart
+++ b/lib/snippets/data_capture_sdk/rtuui_check/top_bar.dart
@@ -1,4 +1,4 @@
-import 'package:scanbot_sdk/scanbot_sdk_ui_v2.dart';
+import 'package:scanbot_sdk/scanbot_sdk.dart';
Future startScanning() async {
// Create an instance of the default configuration
@@ -11,8 +11,12 @@ Future startScanning() async {
configuration.topBar.cancelButton.text = 'Cancel';
configuration.topBar.cancelButton.foreground.color = ScanbotColor('#C8193C');
// Start the Check Scanner UI
- var result = await ScanbotSdkUiV2.startCheckScanner(configuration);
- if (result.status == OperationStatus.OK) {
- // ...
+ var result = await ScanbotSdk.check.startScanner(configuration);
+ if (result is Ok) {
+ /** Handle the result **/
+ var scannerUiResult = result.value;
+ print(scannerUiResult.toString());
+ } else {
+ print(result.toString());
}
-}
\ No newline at end of file
+}
diff --git a/lib/snippets/data_capture_sdk/rtuui_check/user_guidance.dart b/lib/snippets/data_capture_sdk/rtuui_check/user_guidance.dart
index a6673c7..59bec10 100644
--- a/lib/snippets/data_capture_sdk/rtuui_check/user_guidance.dart
+++ b/lib/snippets/data_capture_sdk/rtuui_check/user_guidance.dart
@@ -1,4 +1,4 @@
-import 'package:scanbot_sdk/scanbot_sdk_ui_v2.dart';
+import 'package:scanbot_sdk/scanbot_sdk.dart';
Future startScanning() async {
// Create an instance of the default configuration
@@ -20,8 +20,12 @@ Future startScanning() async {
// Customize the scan status guidance background
scanStatusUserGuidance.background.fillColor = ScanbotColor('#C8193C');
// Start the Check Scanner UI
- var result = await ScanbotSdkUiV2.startCheckScanner(configuration);
- if (result.status == OperationStatus.OK) {
- // ...
+ var result = await ScanbotSdk.check.startScanner(configuration);
+ if (result is Ok) {
+ /** Handle the result **/
+ var scannerUiResult = result.value;
+ print(scannerUiResult.toString());
+ } else {
+ print(result.toString());
}
-}
\ No newline at end of file
+}
diff --git a/lib/snippets/data_capture_sdk/rtuui_credit_card/action_bar.dart b/lib/snippets/data_capture_sdk/rtuui_credit_card/action_bar.dart
index 973487b..cd7518b 100644
--- a/lib/snippets/data_capture_sdk/rtuui_credit_card/action_bar.dart
+++ b/lib/snippets/data_capture_sdk/rtuui_credit_card/action_bar.dart
@@ -1,4 +1,4 @@
-import 'package:scanbot_sdk/scanbot_sdk_ui_v2.dart';
+import 'package:scanbot_sdk/scanbot_sdk.dart';
Future startScanning() async {
/** Create an instance of the default configuration */
@@ -16,8 +16,12 @@ Future startScanning() async {
/** Hide the flip camera button */
actionBar.flipCameraButton.visible = false;
/** Start the Credit Card Scanner **/
- var result = await ScanbotSdkUiV2.startCreditCardScanner(configuration);
- if (result.status == OperationStatus.OK) {
- // ...
+ var result = await ScanbotSdk.creditCard.startScanner(configuration);
+ if (result is Ok) {
+ /** Handle the result **/
+ var scannerUiResult = result.value;
+ print(scannerUiResult.toString());
+ } else {
+ print(result.toString());
}
-}
\ No newline at end of file
+}
diff --git a/lib/snippets/data_capture_sdk/rtuui_credit_card/finder_overlay.dart b/lib/snippets/data_capture_sdk/rtuui_credit_card/finder_overlay.dart
index 5c9e57e..c99b790 100644
--- a/lib/snippets/data_capture_sdk/rtuui_credit_card/finder_overlay.dart
+++ b/lib/snippets/data_capture_sdk/rtuui_credit_card/finder_overlay.dart
@@ -1,4 +1,4 @@
-import 'package:scanbot_sdk/scanbot_sdk_ui_v2.dart';
+import 'package:scanbot_sdk/scanbot_sdk.dart';
Future startScanning() async {
/** Create an instance of the default configuration */
@@ -11,8 +11,12 @@ Future startScanning() async {
strokeWidth: 2,
);
/** Start the Credit Card Scanner **/
- var result = await ScanbotSdkUiV2.startCreditCardScanner(configuration);
- if (result.status == OperationStatus.OK) {
- // ...
+ var result = await ScanbotSdk.creditCard.startScanner(configuration);
+ if (result is Ok) {
+ /** Handle the result **/
+ var scannerUiResult = result.value;
+ print(scannerUiResult.toString());
+ } else {
+ print(result.toString());
}
-}
\ No newline at end of file
+}
diff --git a/lib/snippets/data_capture_sdk/rtuui_credit_card/introduction_screen.dart b/lib/snippets/data_capture_sdk/rtuui_credit_card/introduction_screen.dart
index 3a3395d..d2d92e0 100644
--- a/lib/snippets/data_capture_sdk/rtuui_credit_card/introduction_screen.dart
+++ b/lib/snippets/data_capture_sdk/rtuui_credit_card/introduction_screen.dart
@@ -1,4 +1,4 @@
-import 'package:scanbot_sdk/scanbot_sdk_ui_v2.dart';
+import 'package:scanbot_sdk/scanbot_sdk.dart';
Future startScanning() async {
/** Create an instance of the default configuration */
@@ -13,19 +13,23 @@ Future startScanning() async {
text: 'Credit Card Scanner',
);
/** Configure the image for the introduction screen. */
- introductionConfiguration.image = CreditCardIntroCustomImage(
- uri: 'imageUri',
- );
+ introductionConfiguration.image = CreditCardIntroCustomImage(uri: 'imageUri');
/** Configure the text. **/
configuration.introScreen.explanation.color = ScanbotColor('#000000');
configuration.introScreen.explanation.text =
- "To quickly and securely input your credit card details, please hold your device over the credit card, so that the camera aligns with the numbers on the front of the card.\n\nThe scanner will guide you to the optimal scanning position. Once the scan is complete, your card details will automatically be extracted and processed.\n\nPress 'Start Scanning' to begin.";
+ "To quickly and securely input your credit card details, please hold your device over the credit card, so that the camera aligns with the numbers on the front of the card.\n\nThe scanner will guide you to the optimal scanning position. Once the scan is complete, your card details will automatically be extracted and processed.\n\nPress 'Start Scanning' to begin.";
/** Configure the done button. E.g., the text or the background color. **/
configuration.introScreen.doneButton.text = 'Start Scanning';
- configuration.introScreen.doneButton.background.fillColor = ScanbotColor('#C8193C');
+ configuration.introScreen.doneButton.background.fillColor = ScanbotColor(
+ '#C8193C',
+ );
/** Start the Credit Card Scanner **/
- var result = await ScanbotSdkUiV2.startCreditCardScanner(configuration);
- if (result.status == OperationStatus.OK) {
- // ...
+ var result = await ScanbotSdk.creditCard.startScanner(configuration);
+ if (result is Ok) {
+ /** Handle the result **/
+ var scannerUiResult = result.value;
+ print(scannerUiResult.toString());
+ } else {
+ print(result.toString());
}
-}
\ No newline at end of file
+}
diff --git a/lib/snippets/data_capture_sdk/rtuui_credit_card/launching_the_scanner.dart b/lib/snippets/data_capture_sdk/rtuui_credit_card/launching_the_scanner.dart
index 7dc9f0a..177c403 100644
--- a/lib/snippets/data_capture_sdk/rtuui_credit_card/launching_the_scanner.dart
+++ b/lib/snippets/data_capture_sdk/rtuui_credit_card/launching_the_scanner.dart
@@ -1,11 +1,15 @@
-import 'package:scanbot_sdk/scanbot_sdk_ui_v2.dart';
+import 'package:scanbot_sdk/scanbot_sdk.dart';
Future startScanning() async {
/** Create an instance of the default configuration */
var configuration = CreditCardScannerScreenConfiguration();
/** Start the Credit Card Scanner **/
- var result = await ScanbotSdkUiV2.startCreditCardScanner(configuration);
- if (result.status == OperationStatus.OK) {
- // ...
+ var result = await ScanbotSdk.creditCard.startScanner(configuration);
+ if (result is Ok) {
+ /** Handle the result **/
+ var scannerUiResult = result.value;
+ print(scannerUiResult.toString());
+ } else {
+ print(result.toString());
}
-}
\ No newline at end of file
+}
diff --git a/lib/snippets/data_capture_sdk/rtuui_credit_card/localization.dart b/lib/snippets/data_capture_sdk/rtuui_credit_card/localization.dart
index d0289b1..7601a10 100644
--- a/lib/snippets/data_capture_sdk/rtuui_credit_card/localization.dart
+++ b/lib/snippets/data_capture_sdk/rtuui_credit_card/localization.dart
@@ -1,4 +1,4 @@
-import 'package:scanbot_sdk/scanbot_sdk_ui_v2.dart';
+import 'package:scanbot_sdk/scanbot_sdk.dart';
Future startScanning() async {
/** Create an instance of the default configuration */
@@ -8,14 +8,18 @@ Future startScanning() async {
/** Configure the strings. */
localization.topUserGuidance = 'Localized topUserGuidance';
localization.cameraPermissionCloseButton =
- 'Localized cameraPermissionCloseButton';
+ 'Localized cameraPermissionCloseButton';
localization.completionOverlaySuccessMessage =
- 'Localized completionOverlaySuccessMessage';
+ 'Localized completionOverlaySuccessMessage';
localization.creditCardUserGuidanceNoCardFound =
- 'Localized creditCardUserGuidanceNoCardFound';
+ 'Localized creditCardUserGuidanceNoCardFound';
/** Start the Credit Card Scanner **/
- var result = await ScanbotSdkUiV2.startCreditCardScanner(configuration);
- if (result.status == OperationStatus.OK) {
- // ...
+ var result = await ScanbotSdk.creditCard.startScanner(configuration);
+ if (result is Ok) {
+ /** Handle the result **/
+ var scannerUiResult = result.value;
+ print(scannerUiResult.toString());
+ } else {
+ print(result.toString());
}
-}
\ No newline at end of file
+}
diff --git a/lib/snippets/data_capture_sdk/rtuui_credit_card/palette.dart b/lib/snippets/data_capture_sdk/rtuui_credit_card/palette.dart
index 8484cfc..c57e02a 100644
--- a/lib/snippets/data_capture_sdk/rtuui_credit_card/palette.dart
+++ b/lib/snippets/data_capture_sdk/rtuui_credit_card/palette.dart
@@ -1,4 +1,4 @@
-import 'package:scanbot_sdk/scanbot_sdk_ui_v2.dart';
+import 'package:scanbot_sdk/scanbot_sdk.dart';
Future startScanning() async {
/** Create an instance of the default configuration */
@@ -23,8 +23,12 @@ Future startScanning() async {
palette.sbColorSurfaceHigh = ScanbotColor('#7A000000');
palette.sbColorModalOverlay = ScanbotColor('#A3000000');
/** Start the Credit Card Scanner **/
- var result = await ScanbotSdkUiV2.startCreditCardScanner(configuration);
- if (result.status == OperationStatus.OK) {
- // ...
+ var result = await ScanbotSdk.creditCard.startScanner(configuration);
+ if (result is Ok) {
+ /** Handle the result **/
+ var scannerUiResult = result.value;
+ print(scannerUiResult.toString());
+ } else {
+ print(result.toString());
}
-}
\ No newline at end of file
+}
diff --git a/lib/snippets/data_capture_sdk/rtuui_credit_card/top_bar.dart b/lib/snippets/data_capture_sdk/rtuui_credit_card/top_bar.dart
index 13f38d3..9dff56b 100644
--- a/lib/snippets/data_capture_sdk/rtuui_credit_card/top_bar.dart
+++ b/lib/snippets/data_capture_sdk/rtuui_credit_card/top_bar.dart
@@ -1,4 +1,4 @@
-import 'package:scanbot_sdk/scanbot_sdk_ui_v2.dart';
+import 'package:scanbot_sdk/scanbot_sdk.dart';
Future startScanning() async {
/** Create an instance of the default configuration */
@@ -11,8 +11,12 @@ Future startScanning() async {
configuration.topBar.cancelButton.text = 'Cancel';
configuration.topBar.cancelButton.foreground.color = ScanbotColor('#C8193C');
/** Start the Credit Card Scanner **/
- var result = await ScanbotSdkUiV2.startCreditCardScanner(configuration);
- if (result.status == OperationStatus.OK) {
- // ...
+ var result = await ScanbotSdk.creditCard.startScanner(configuration);
+ if (result is Ok) {
+ /** Handle the result **/
+ var scannerUiResult = result.value;
+ print(scannerUiResult.toString());
+ } else {
+ print(result.toString());
}
-}
\ No newline at end of file
+}
diff --git a/lib/snippets/data_capture_sdk/rtuui_credit_card/user_guidance.dart b/lib/snippets/data_capture_sdk/rtuui_credit_card/user_guidance.dart
index 2bd746d..a40f276 100644
--- a/lib/snippets/data_capture_sdk/rtuui_credit_card/user_guidance.dart
+++ b/lib/snippets/data_capture_sdk/rtuui_credit_card/user_guidance.dart
@@ -1,4 +1,4 @@
-import 'package:scanbot_sdk/scanbot_sdk_ui_v2.dart';
+import 'package:scanbot_sdk/scanbot_sdk.dart';
Future startScanning() async {
/** Create an instance of the default configuration */
@@ -23,8 +23,12 @@ Future startScanning() async {
/** Customize the status user guidance background */
scanStatusUserGuidance.background.fillColor = ScanbotColor('#C8193C');
/** Start the Credit Card Scanner **/
- var result = await ScanbotSdkUiV2.startCreditCardScanner(configuration);
- if (result.status == OperationStatus.OK) {
- // ...
+ var result = await ScanbotSdk.creditCard.startScanner(configuration);
+ if (result is Ok) {
+ /** Handle the result **/
+ var scannerUiResult = result.value;
+ print(scannerUiResult.toString());
+ } else {
+ print(result.toString());
}
-}
\ No newline at end of file
+}
diff --git a/lib/snippets/data_capture_sdk/rtuui_dde/action_bar.dart b/lib/snippets/data_capture_sdk/rtuui_dde/action_bar.dart
index d8b55aa..4914e63 100644
--- a/lib/snippets/data_capture_sdk/rtuui_dde/action_bar.dart
+++ b/lib/snippets/data_capture_sdk/rtuui_dde/action_bar.dart
@@ -1,4 +1,4 @@
-import 'package:scanbot_sdk/scanbot_sdk_ui_v2.dart';
+import 'package:scanbot_sdk/scanbot_sdk.dart';
Future startScanning() async {
/** Create an instance of the default configuration */
@@ -16,8 +16,14 @@ Future startScanning() async {
/** Hide the flip camera button */
actionBar.flipCameraButton.visible = false;
/** Start the Document Data Extractor **/
- var result = await ScanbotSdkUiV2.startDocumentDataExtractor(configuration);
- if (result.status == OperationStatus.OK) {
- // ...
+ var result = await ScanbotSdk.documentDataExtractor.startExtractorScreen(
+ configuration,
+ );
+ if (result is Ok) {
+ /** Handle the result **/
+ var documentDataExtractorUiResult = result.value;
+ print(documentDataExtractorUiResult.toString());
+ } else {
+ print(result.toString());
}
-}
\ No newline at end of file
+}
diff --git a/lib/snippets/data_capture_sdk/rtuui_dde/finder_overlay.dart b/lib/snippets/data_capture_sdk/rtuui_dde/finder_overlay.dart
index 7471e9b..81f45ed 100644
--- a/lib/snippets/data_capture_sdk/rtuui_dde/finder_overlay.dart
+++ b/lib/snippets/data_capture_sdk/rtuui_dde/finder_overlay.dart
@@ -1,4 +1,4 @@
-import 'package:scanbot_sdk/scanbot_sdk_ui_v2.dart';
+import 'package:scanbot_sdk/scanbot_sdk.dart';
Future startScanning() async {
// Create an instance of the default configuration
@@ -15,8 +15,14 @@ Future startScanning() async {
configuration.viewFinder.style = FinderCorneredStyle(strokeWidth: 3.0);
// Start the DDE
- var result = await ScanbotSdkUiV2.startDocumentDataExtractor(configuration);
- if (result.status == OperationStatus.OK) {
- // ...
+ var result = await ScanbotSdk.documentDataExtractor.startExtractorScreen(
+ configuration,
+ );
+ if (result is Ok) {
+ /** Handle the result **/
+ var documentDataExtractorUiResult = result.value;
+ print(documentDataExtractorUiResult.toString());
+ } else {
+ print(result.toString());
}
-}
\ No newline at end of file
+}
diff --git a/lib/snippets/data_capture_sdk/rtuui_dde/introduction_screen.dart b/lib/snippets/data_capture_sdk/rtuui_dde/introduction_screen.dart
index 49526e2..c07b0d2 100644
--- a/lib/snippets/data_capture_sdk/rtuui_dde/introduction_screen.dart
+++ b/lib/snippets/data_capture_sdk/rtuui_dde/introduction_screen.dart
@@ -1,4 +1,4 @@
-import 'package:scanbot_sdk/scanbot_sdk_ui_v2.dart';
+import 'package:scanbot_sdk/scanbot_sdk.dart';
Future startScanning() async {
// Create an instance of the default configuration
@@ -14,11 +14,13 @@ Future startScanning() async {
// Configure the image for the introduction screen.
// If you want to have no image...
- configuration.introScreen.image = DocumentDataExtractorIntroImage.documentDataIntroNoImage();
+ configuration.introScreen.image =
+ DocumentDataExtractorIntroImage.documentDataIntroNoImage();
// For a custom image...
// configuration.introScreen.image = DocumentDataExtractorIntroImage.documentDataIntroCustomImage(uri: "PathToImage")
// Or you can also use our default image.
- configuration.introScreen.image = DocumentDataExtractorIntroImage.documentDataIntroDefaultImage();
+ configuration.introScreen.image =
+ DocumentDataExtractorIntroImage.documentDataIntroDefaultImage();
// Configure the color of the handler on top.
configuration.introScreen.handlerColor = ScanbotColor("#EFEFEF");
@@ -28,16 +30,25 @@ Future startScanning() async {
// Configure the text.
configuration.introScreen.explanation.color = ScanbotColor("#000000");
- configuration.introScreen.explanation.text = "To quickly and securely scan your document details, please hold your device over the document, so that the camera aligns with all the information on the document.\n\nThe scanner will guide you to the optimal scanning position. Once the scan is complete, your document details will automatically be extracted and processed.\n\nPress 'Start Scanning' to begin.";
+ configuration.introScreen.explanation.text =
+ "To quickly and securely scan your document details, please hold your device over the document, so that the camera aligns with all the information on the document.\n\nThe scanner will guide you to the optimal scanning position. Once the scan is complete, your document details will automatically be extracted and processed.\n\nPress 'Start Scanning' to begin.";
// Configure the done button.
// e.g the text or the background color.
configuration.introScreen.doneButton.text = "Start Scanning";
- configuration.introScreen.doneButton.background.fillColor = ScanbotColor("#C8193C");
+ configuration.introScreen.doneButton.background.fillColor = ScanbotColor(
+ "#C8193C",
+ );
// Start the DDE
- var result = await ScanbotSdkUiV2.startDocumentDataExtractor(configuration);
- if (result.status == OperationStatus.OK) {
- // ...
+ var result = await ScanbotSdk.documentDataExtractor.startExtractorScreen(
+ configuration,
+ );
+ if (result is Ok) {
+ /** Handle the result **/
+ var documentDataExtractorUiResult = result.value;
+ print(documentDataExtractorUiResult.toString());
+ } else {
+ print(result.toString());
}
-}
\ No newline at end of file
+}
diff --git a/lib/snippets/data_capture_sdk/rtuui_dde/launching_the_scanner.dart b/lib/snippets/data_capture_sdk/rtuui_dde/launching_the_scanner.dart
index 0dc2fe7..8b3741b 100644
--- a/lib/snippets/data_capture_sdk/rtuui_dde/launching_the_scanner.dart
+++ b/lib/snippets/data_capture_sdk/rtuui_dde/launching_the_scanner.dart
@@ -1,25 +1,50 @@
-import 'package:scanbot_sdk/scanbot_sdk_ui_v2.dart';
+import 'package:scanbot_sdk/scanbot_sdk.dart';
Future startScanning() async {
// Create an instance of the default configuration
var configuration = DocumentDataExtractorScreenConfiguration();
// Start the Document Data Extractor
- var result = await ScanbotSdkUiV2.startDocumentDataExtractor(configuration);
- if (result.status == OperationStatus.OK) {
+ var result = await ScanbotSdk.documentDataExtractor.startExtractorScreen(
+ configuration,
+ );
+
+ if (result is Ok) {
// Cast the resulted generic document to the appropriate document model.
// Available document types are defined in [DocumentsModelRootType] enum.
- var documentModel = DeIdCardFront(result.data!.document!);
+ var documentModel = DeIdCardFront(result.value.document!);
// Retrieve values from the German ID card front
- print('Birth date: ${documentModel.birthDate.value?.text}, Confidence: ${documentModel.birthDate.value?.confidence}');
- print('Birthplace: ${documentModel.birthplace.value?.text}, Confidence: ${documentModel.birthplace.value?.confidence}');
- print('Card access number: ${documentModel.cardAccessNumber.value?.text}, Confidence: ${documentModel.cardAccessNumber.value?.confidence}');
- print('Expiry date: ${documentModel.expiryDate.value?.text}, Confidence: ${documentModel.expiryDate.value?.confidence}');
- print('Given names: ${documentModel.givenNames.value?.text}, Confidence: ${documentModel.givenNames.value?.confidence}');
- print('ID: ${documentModel.id.value?.text}, Confidence: ${documentModel.id.value?.confidence}');
- print('Maiden name: ${documentModel.maidenName?.value?.text}, Confidence: ${documentModel.maidenName?.value?.confidence}');
- print('Nationality: ${documentModel.nationality.value?.text}, Confidence: ${documentModel.nationality.value?.confidence}');
- print('Surname: ${documentModel.surname.value?.text}, Confidence: ${documentModel.surname.value?.confidence}');
- print('Series: ${documentModel.series.value?.text}, Confidence: ${documentModel.series.value?.confidence}');
+ print(
+ 'Birth date: ${documentModel.birthDate.value?.text}, Confidence: ${documentModel.birthDate.value?.confidence}',
+ );
+ print(
+ 'Birthplace: ${documentModel.birthplace.value?.text}, Confidence: ${documentModel.birthplace.value?.confidence}',
+ );
+ print(
+ 'Card access number: ${documentModel.cardAccessNumber.value?.text}, Confidence: ${documentModel.cardAccessNumber.value?.confidence}',
+ );
+ print(
+ 'Expiry date: ${documentModel.expiryDate.value?.text}, Confidence: ${documentModel.expiryDate.value?.confidence}',
+ );
+ print(
+ 'Given names: ${documentModel.givenNames.value?.text}, Confidence: ${documentModel.givenNames.value?.confidence}',
+ );
+ print(
+ 'ID: ${documentModel.id.value?.text}, Confidence: ${documentModel.id.value?.confidence}',
+ );
+ print(
+ 'Maiden name: ${documentModel.maidenName?.value?.text}, Confidence: ${documentModel.maidenName?.value?.confidence}',
+ );
+ print(
+ 'Nationality: ${documentModel.nationality.value?.text}, Confidence: ${documentModel.nationality.value?.confidence}',
+ );
+ print(
+ 'Surname: ${documentModel.surname.value?.text}, Confidence: ${documentModel.surname.value?.confidence}',
+ );
+ print(
+ 'Series: ${documentModel.series.value?.text}, Confidence: ${documentModel.series.value?.confidence}',
+ );
+ } else {
+ print(result.toString());
}
-}
\ No newline at end of file
+}
diff --git a/lib/snippets/data_capture_sdk/rtuui_dde/localization.dart b/lib/snippets/data_capture_sdk/rtuui_dde/localization.dart
index ebf7804..f538d1c 100644
--- a/lib/snippets/data_capture_sdk/rtuui_dde/localization.dart
+++ b/lib/snippets/data_capture_sdk/rtuui_dde/localization.dart
@@ -1,4 +1,4 @@
-import 'package:scanbot_sdk/scanbot_sdk_ui_v2.dart';
+import 'package:scanbot_sdk/scanbot_sdk.dart';
Future startScanning() async {
// Create an instance of the default configuration
@@ -8,13 +8,19 @@ Future startScanning() async {
// Configure the strings.
localization.topUserGuidance = 'Localized topUserGuidance';
localization.cameraPermissionCloseButton =
- 'Localized cameraPermissionCloseButton';
+ 'Localized cameraPermissionCloseButton';
localization.completionOverlaySuccessMessage =
- 'Localized completionOverlaySuccessMessage';
+ 'Localized completionOverlaySuccessMessage';
// Start the DDE
- var result = await ScanbotSdkUiV2.startDocumentDataExtractor(configuration);
- if (result.status == OperationStatus.OK) {
- // ...
+ var result = await ScanbotSdk.documentDataExtractor.startExtractorScreen(
+ configuration,
+ );
+ if (result is Ok) {
+ /** Handle the result **/
+ var documentDataExtractorUiResult = result.value;
+ print(documentDataExtractorUiResult.toString());
+ } else {
+ print(result.toString());
}
-}
\ No newline at end of file
+}
diff --git a/lib/snippets/data_capture_sdk/rtuui_dde/palette.dart b/lib/snippets/data_capture_sdk/rtuui_dde/palette.dart
index 744769a..0e71ff7 100644
--- a/lib/snippets/data_capture_sdk/rtuui_dde/palette.dart
+++ b/lib/snippets/data_capture_sdk/rtuui_dde/palette.dart
@@ -1,4 +1,4 @@
-import 'package:scanbot_sdk/scanbot_sdk_ui_v2.dart';
+import 'package:scanbot_sdk/scanbot_sdk.dart';
Future startScanning() async {
/** Create an instance of the default configuration */
@@ -23,8 +23,14 @@ Future startScanning() async {
palette.sbColorSurfaceHigh = ScanbotColor('#7A000000');
palette.sbColorModalOverlay = ScanbotColor('#A3000000');
/** Start the DDE **/
- var result = await ScanbotSdkUiV2.startDocumentDataExtractor(configuration);
- if (result.status == OperationStatus.OK) {
- // ...
+ var result = await ScanbotSdk.documentDataExtractor.startExtractorScreen(
+ configuration,
+ );
+ if (result is Ok) {
+ /** Handle the result **/
+ var documentDataExtractorUiResult = result.value;
+ print(documentDataExtractorUiResult.toString());
+ } else {
+ print(result.toString());
}
-}
\ No newline at end of file
+}
diff --git a/lib/snippets/data_capture_sdk/rtuui_dde/top_bar.dart b/lib/snippets/data_capture_sdk/rtuui_dde/top_bar.dart
index 00d862e..346491e 100644
--- a/lib/snippets/data_capture_sdk/rtuui_dde/top_bar.dart
+++ b/lib/snippets/data_capture_sdk/rtuui_dde/top_bar.dart
@@ -1,4 +1,4 @@
-import 'package:scanbot_sdk/scanbot_sdk_ui_v2.dart';
+import 'package:scanbot_sdk/scanbot_sdk.dart';
Future startScanning() async {
/** Create an instance of the default configuration */
@@ -11,8 +11,14 @@ Future startScanning() async {
configuration.topBar.cancelButton.text = 'Cancel';
configuration.topBar.cancelButton.foreground.color = ScanbotColor('#C8193C');
/** Start the DDE **/
- var result = await ScanbotSdkUiV2.startDocumentDataExtractor(configuration);
- if (result.status == OperationStatus.OK) {
- // ...
+ var result = await ScanbotSdk.documentDataExtractor.startExtractorScreen(
+ configuration,
+ );
+ if (result is Ok) {
+ /** Handle the result **/
+ var documentDataExtractorUiResult = result.value;
+ print(documentDataExtractorUiResult.toString());
+ } else {
+ print(result.toString());
}
-}
\ No newline at end of file
+}
diff --git a/lib/snippets/data_capture_sdk/rtuui_dde/user_guidance.dart b/lib/snippets/data_capture_sdk/rtuui_dde/user_guidance.dart
index 5ed0042..d622ab4 100644
--- a/lib/snippets/data_capture_sdk/rtuui_dde/user_guidance.dart
+++ b/lib/snippets/data_capture_sdk/rtuui_dde/user_guidance.dart
@@ -1,4 +1,4 @@
-import 'package:scanbot_sdk/scanbot_sdk_ui_v2.dart';
+import 'package:scanbot_sdk/scanbot_sdk.dart';
Future startScanning() async {
// Create an instance of the default configuration
@@ -24,8 +24,14 @@ Future startScanning() async {
// Configure the background.
scanStatusUserGuidance.background.fillColor = ScanbotColor("#7A000000");
// Start the DDE
- var result = await ScanbotSdkUiV2.startDocumentDataExtractor(configuration);
- if (result.status == OperationStatus.OK) {
- // ...
+ var result = await ScanbotSdk.documentDataExtractor.startExtractorScreen(
+ configuration,
+ );
+ if (result is Ok) {
+ /** Handle the result **/
+ var documentDataExtractorUiResult = result.value;
+ print(documentDataExtractorUiResult.toString());
+ } else {
+ print(result.toString());
}
-}
\ No newline at end of file
+}
diff --git a/lib/snippets/data_capture_sdk/rtuui_mrz/action_bar.dart b/lib/snippets/data_capture_sdk/rtuui_mrz/action_bar.dart
index d118919..933e294 100644
--- a/lib/snippets/data_capture_sdk/rtuui_mrz/action_bar.dart
+++ b/lib/snippets/data_capture_sdk/rtuui_mrz/action_bar.dart
@@ -1,4 +1,4 @@
-import 'package:scanbot_sdk/scanbot_sdk_ui_v2.dart';
+import 'package:scanbot_sdk/scanbot_sdk.dart';
Future startScanning() async {
/** Create an instance of the default configuration */
@@ -18,8 +18,12 @@ Future startScanning() async {
actionBar.flipCameraButton.visible = false;
/** Start the MRZ Scanner UI */
- var result = await ScanbotSdkUiV2.startMrzScanner(configuration);
- if (result.status == OperationStatus.OK) {
- // ...
+ var result = await ScanbotSdk.mrz.startScanner(configuration);
+ if (result is Ok) {
+ /** Handle the result **/
+ var scannerUiResult = result.value;
+ print(scannerUiResult.toString());
+ } else {
+ print(result.toString());
}
-}
\ No newline at end of file
+}
diff --git a/lib/snippets/data_capture_sdk/rtuui_mrz/finder_overlay.dart b/lib/snippets/data_capture_sdk/rtuui_mrz/finder_overlay.dart
index efbb986..2acf6e6 100644
--- a/lib/snippets/data_capture_sdk/rtuui_mrz/finder_overlay.dart
+++ b/lib/snippets/data_capture_sdk/rtuui_mrz/finder_overlay.dart
@@ -1,4 +1,4 @@
-import 'package:scanbot_sdk/scanbot_sdk_ui_v2.dart';
+import 'package:scanbot_sdk/scanbot_sdk.dart';
Future startScanning() async {
/** Create an instance of the default configuration */
@@ -17,8 +17,12 @@ Future startScanning() async {
strokeWidth: 2,
);
/** Start the MRZ Scanner UI */
- var result = await ScanbotSdkUiV2.startMrzScanner(configuration);
- if (result.status == OperationStatus.OK) {
- // ...
+ var result = await ScanbotSdk.mrz.startScanner(configuration);
+ if (result is Ok) {
+ /** Handle the result **/
+ var scannerUiResult = result.value;
+ print(scannerUiResult.toString());
+ } else {
+ print(result.toString());
}
-}
\ No newline at end of file
+}
diff --git a/lib/snippets/data_capture_sdk/rtuui_mrz/introduction_screen.dart b/lib/snippets/data_capture_sdk/rtuui_mrz/introduction_screen.dart
index cce2702..60b4a56 100644
--- a/lib/snippets/data_capture_sdk/rtuui_mrz/introduction_screen.dart
+++ b/lib/snippets/data_capture_sdk/rtuui_mrz/introduction_screen.dart
@@ -1,4 +1,4 @@
-import 'package:scanbot_sdk/scanbot_sdk_ui_v2.dart';
+import 'package:scanbot_sdk/scanbot_sdk.dart';
Future startScanning() async {
/** Create an instance of the default configuration */
@@ -13,19 +13,23 @@ Future startScanning() async {
text: 'MRZ Scanner',
);
/** Configure the image for the introduction screen. */
- introductionConfiguration.image = MrzIntroCustomImage(
- uri: 'imageUri',
- );
+ introductionConfiguration.image = MrzIntroCustomImage(uri: 'imageUri');
/** Configure the text. **/
configuration.introScreen.explanation.color = ScanbotColor('#000000');
configuration.introScreen.explanation.text =
- "The Machine Readable Zone (MRZ) is a special code on your ID document (such as a passport or ID card) that contains your personal information in a machine-readable format.\n\nTo scan it, simply hold your camera over the document, so that it aligns with the MRZ section. Once scanned, the data will be automatically processed, and you will be directed to the results screen.\n\nPress 'Start Scanning' to begin.";
+ "The Machine Readable Zone (MRZ) is a special code on your ID document (such as a passport or ID card) that contains your personal information in a machine-readable format.\n\nTo scan it, simply hold your camera over the document, so that it aligns with the MRZ section. Once scanned, the data will be automatically processed, and you will be directed to the results screen.\n\nPress 'Start Scanning' to begin.";
/** Configure the done button. E.g., the text or the background color. **/
configuration.introScreen.doneButton.text = 'Start Scanning';
- configuration.introScreen.doneButton.background.fillColor = ScanbotColor('#C8193C');
+ configuration.introScreen.doneButton.background.fillColor = ScanbotColor(
+ '#C8193C',
+ );
/** Start the MRZ Scanner UI */
- var result = await ScanbotSdkUiV2.startMrzScanner(configuration);
- if (result.status == OperationStatus.OK) {
- // ...
+ var result = await ScanbotSdk.mrz.startScanner(configuration);
+ if (result is Ok) {
+ /** Handle the result **/
+ var scannerUiResult = result.value;
+ print(scannerUiResult.toString());
+ } else {
+ print(result.toString());
}
-}
\ No newline at end of file
+}
diff --git a/lib/snippets/data_capture_sdk/rtuui_mrz/launching_the_scanner.dart b/lib/snippets/data_capture_sdk/rtuui_mrz/launching_the_scanner.dart
index 65834eb..559c9b7 100644
--- a/lib/snippets/data_capture_sdk/rtuui_mrz/launching_the_scanner.dart
+++ b/lib/snippets/data_capture_sdk/rtuui_mrz/launching_the_scanner.dart
@@ -1,16 +1,22 @@
-import 'package:scanbot_sdk/scanbot_sdk_ui_v2.dart';
+import 'package:scanbot_sdk/scanbot_sdk.dart';
Future startScanning() async {
// Create an instance of the default configuration
var configuration = MrzScannerScreenConfiguration();
// Start the MRZ Scanner
- var result = await ScanbotSdkUiV2.startMrzScanner(configuration);
- if (result.status == OperationStatus.OK) {
+ var result = await ScanbotSdk.mrz.startScanner(configuration);
+ if (result is Ok) {
// Cast the resulted generic document to the MRZ model.
- var mrzModel = MRZ(result.data!.mrzDocument!);
+ var mrzModel = MRZ(result.value.mrzDocument!);
// Retrieve the values.
// e.g
- print('Birth date: ${mrzModel.birthDate.value?.text}, Confidence: ${mrzModel.birthDate.value?.confidence}');
- print('Nationality: ${mrzModel.nationality.value?.text}, Confidence: ${mrzModel.nationality.value?.confidence}');
+ print(
+ 'Birth date: ${mrzModel.birthDate.value?.text}, Confidence: ${mrzModel.birthDate.value?.confidence}',
+ );
+ print(
+ 'Nationality: ${mrzModel.nationality.value?.text}, Confidence: ${mrzModel.nationality.value?.confidence}',
+ );
+ } else {
+ print(result.toString());
}
-}
\ No newline at end of file
+}
diff --git a/lib/snippets/data_capture_sdk/rtuui_mrz/localization.dart b/lib/snippets/data_capture_sdk/rtuui_mrz/localization.dart
index 2229760..225d358 100644
--- a/lib/snippets/data_capture_sdk/rtuui_mrz/localization.dart
+++ b/lib/snippets/data_capture_sdk/rtuui_mrz/localization.dart
@@ -1,4 +1,4 @@
-import 'package:scanbot_sdk/scanbot_sdk_ui_v2.dart';
+import 'package:scanbot_sdk/scanbot_sdk.dart';
Future startScanning() async {
/** Create an instance of the default configuration */
@@ -8,13 +8,17 @@ Future startScanning() async {
/** Configure the strings. */
localization.topUserGuidance = 'Localized topUserGuidance';
localization.cameraPermissionCloseButton =
- 'Localized cameraPermissionCloseButton';
+ 'Localized cameraPermissionCloseButton';
localization.completionOverlaySuccessMessage =
- 'Localized completionOverlaySuccessMessage';
+ 'Localized completionOverlaySuccessMessage';
localization.finderViewUserGuidance = 'Localized finderViewUserGuidance';
/** Start the MRZ Scanner UI */
- var result = await ScanbotSdkUiV2.startMrzScanner(configuration);
- if (result.status == OperationStatus.OK) {
- // ...
+ var result = await ScanbotSdk.mrz.startScanner(configuration);
+ if (result is Ok) {
+ /** Handle the result **/
+ var scannerUiResult = result.value;
+ print(scannerUiResult.toString());
+ } else {
+ print(result.toString());
}
-}
\ No newline at end of file
+}
diff --git a/lib/snippets/data_capture_sdk/rtuui_mrz/palette.dart b/lib/snippets/data_capture_sdk/rtuui_mrz/palette.dart
index e953044..7aa373b 100644
--- a/lib/snippets/data_capture_sdk/rtuui_mrz/palette.dart
+++ b/lib/snippets/data_capture_sdk/rtuui_mrz/palette.dart
@@ -1,4 +1,4 @@
-import 'package:scanbot_sdk/scanbot_sdk_ui_v2.dart';
+import 'package:scanbot_sdk/scanbot_sdk.dart';
Future startScanning() async {
/** Create an instance of the default configuration */
@@ -23,8 +23,12 @@ Future startScanning() async {
palette.sbColorSurfaceHigh = ScanbotColor('#7A000000');
palette.sbColorModalOverlay = ScanbotColor('#A3000000');
/** Start the MRZ Scanner UI */
- var result = await ScanbotSdkUiV2.startMrzScanner(configuration);
- if (result.status == OperationStatus.OK) {
- // ...
+ var result = await ScanbotSdk.mrz.startScanner(configuration);
+ if (result is Ok) {
+ /** Handle the result **/
+ var scannerUiResult = result.value;
+ print(scannerUiResult.toString());
+ } else {
+ print(result.toString());
}
-}
\ No newline at end of file
+}
diff --git a/lib/snippets/data_capture_sdk/rtuui_mrz/top_bar.dart b/lib/snippets/data_capture_sdk/rtuui_mrz/top_bar.dart
index 54b8be6..f9dab71 100644
--- a/lib/snippets/data_capture_sdk/rtuui_mrz/top_bar.dart
+++ b/lib/snippets/data_capture_sdk/rtuui_mrz/top_bar.dart
@@ -1,4 +1,4 @@
-import 'package:scanbot_sdk/scanbot_sdk_ui_v2.dart';
+import 'package:scanbot_sdk/scanbot_sdk.dart';
Future startScanning() async {
/** Create an instance of the default configuration */
@@ -11,8 +11,12 @@ Future startScanning() async {
configuration.topBar.cancelButton.text = 'Cancel';
configuration.topBar.cancelButton.foreground.color = ScanbotColor('#C8193C');
/** Start the MRZ Scanner UI */
- var result = await ScanbotSdkUiV2.startMrzScanner(configuration);
- if (result.status == OperationStatus.OK) {
- // ...
+ var result = await ScanbotSdk.mrz.startScanner(configuration);
+ if (result is Ok) {
+ /** Handle the result **/
+ var scannerUiResult = result.value;
+ print(scannerUiResult.toString());
+ } else {
+ print(result.toString());
}
-}
\ No newline at end of file
+}
diff --git a/lib/snippets/data_capture_sdk/rtuui_mrz/user_guidance.dart b/lib/snippets/data_capture_sdk/rtuui_mrz/user_guidance.dart
index 3495450..93b0daa 100644
--- a/lib/snippets/data_capture_sdk/rtuui_mrz/user_guidance.dart
+++ b/lib/snippets/data_capture_sdk/rtuui_mrz/user_guidance.dart
@@ -1,4 +1,4 @@
-import 'package:scanbot_sdk/scanbot_sdk_ui_v2.dart';
+import 'package:scanbot_sdk/scanbot_sdk.dart';
Future startScanning() async {
/** Create an instance of the default configuration */
@@ -22,8 +22,12 @@ Future startScanning() async {
/** Customize the finder user guidance background */
finderUserGuidance.background.fillColor = ScanbotColor('#C8193C');
/** Start the MRZ Scanner UI */
- var result = await ScanbotSdkUiV2.startMrzScanner(configuration);
- if (result.status == OperationStatus.OK) {
- // ...
+ var result = await ScanbotSdk.mrz.startScanner(configuration);
+ if (result is Ok) {
+ /** Handle the result **/
+ var scannerUiResult = result.value;
+ print(scannerUiResult.toString());
+ } else {
+ print(result.toString());
}
-}
\ No newline at end of file
+}
diff --git a/lib/snippets/data_capture_sdk/rtuui_text_pattern/action_bar.dart b/lib/snippets/data_capture_sdk/rtuui_text_pattern/action_bar.dart
index 172a47e..207e668 100644
--- a/lib/snippets/data_capture_sdk/rtuui_text_pattern/action_bar.dart
+++ b/lib/snippets/data_capture_sdk/rtuui_text_pattern/action_bar.dart
@@ -1,4 +1,4 @@
-import 'package:scanbot_sdk/scanbot_sdk_ui_v2.dart';
+import 'package:scanbot_sdk/scanbot_sdk.dart';
Future startScanning() async {
/** Create an instance of the default configuration */
@@ -18,8 +18,12 @@ Future startScanning() async {
actionBar.flipCameraButton.visible = false;
/** Start the MRZ Scanner UI */
- var result = await ScanbotSdkUiV2.startTextPatternScanner(configuration);
- if (result.status == OperationStatus.OK) {
- // ...
+ var result = await ScanbotSdk.textPattern.startScanner(configuration);
+ if (result is Ok) {
+ /** Handle the result **/
+ var scannerUiResult = result.value;
+ print(scannerUiResult.toString());
+ } else {
+ print(result.toString());
}
-}
\ No newline at end of file
+}
diff --git a/lib/snippets/data_capture_sdk/rtuui_text_pattern/introduction_screen.dart b/lib/snippets/data_capture_sdk/rtuui_text_pattern/introduction_screen.dart
index 64f9434..be84926 100644
--- a/lib/snippets/data_capture_sdk/rtuui_text_pattern/introduction_screen.dart
+++ b/lib/snippets/data_capture_sdk/rtuui_text_pattern/introduction_screen.dart
@@ -1,4 +1,4 @@
-import 'package:scanbot_sdk/scanbot_sdk_ui_v2.dart';
+import 'package:scanbot_sdk/scanbot_sdk.dart';
Future startScanning() async {
/** Create an instance of the default configuration */
@@ -19,13 +19,19 @@ Future startScanning() async {
/** Configure the text. **/
configuration.introScreen.explanation.color = ScanbotColor('#000000');
configuration.introScreen.explanation.text =
- "To scan a single line of text, please hold your device so that the camera viewfinder clearly captures the text you want to scan. Please ensure the text is properly aligned. Once the scan is complete, the text will be automatically extracted.\n\nPress 'Start Scanning' to begin.";
+ "To scan a single line of text, please hold your device so that the camera viewfinder clearly captures the text you want to scan. Please ensure the text is properly aligned. Once the scan is complete, the text will be automatically extracted.\n\nPress 'Start Scanning' to begin.";
/** Configure the done button. E.g., the text or the background color. **/
configuration.introScreen.doneButton.text = 'Start Scanning';
- configuration.introScreen.doneButton.background.fillColor = ScanbotColor('#C8193C');
+ configuration.introScreen.doneButton.background.fillColor = ScanbotColor(
+ '#C8193C',
+ );
/** Start the Text Pattern Scanner **/
- var result = await ScanbotSdkUiV2.startTextPatternScanner(configuration);
- if (result.status == OperationStatus.OK) {
- // ...
+ var result = await ScanbotSdk.textPattern.startScanner(configuration);
+ if (result is Ok) {
+ /** Handle the result **/
+ var scannerUiResult = result.value;
+ print(scannerUiResult.toString());
+ } else {
+ print(result.toString());
}
-}
\ No newline at end of file
+}
diff --git a/lib/snippets/data_capture_sdk/rtuui_text_pattern/launching_the_scanner.dart b/lib/snippets/data_capture_sdk/rtuui_text_pattern/launching_the_scanner.dart
index 7f740c0..68e73f7 100644
--- a/lib/snippets/data_capture_sdk/rtuui_text_pattern/launching_the_scanner.dart
+++ b/lib/snippets/data_capture_sdk/rtuui_text_pattern/launching_the_scanner.dart
@@ -1,11 +1,15 @@
-import 'package:scanbot_sdk/scanbot_sdk_ui_v2.dart';
+import 'package:scanbot_sdk/scanbot_sdk.dart';
Future startScanning() async {
/** Create an instance of the default configuration */
var configuration = TextPatternScannerScreenConfiguration();
/** Start the Text Pattern Scanner **/
- var result = await ScanbotSdkUiV2.startTextPatternScanner(configuration);
- if (result.status == OperationStatus.OK) {
- // ...
+ var result = await ScanbotSdk.textPattern.startScanner(configuration);
+ if (result is Ok) {
+ /** Handle the result **/
+ var scannerUiResult = result.value;
+ print(scannerUiResult.toString());
+ } else {
+ print(result.toString());
}
-}
\ No newline at end of file
+}
diff --git a/lib/snippets/data_capture_sdk/rtuui_text_pattern/localization.dart b/lib/snippets/data_capture_sdk/rtuui_text_pattern/localization.dart
index 4f952d5..4f98e42 100644
--- a/lib/snippets/data_capture_sdk/rtuui_text_pattern/localization.dart
+++ b/lib/snippets/data_capture_sdk/rtuui_text_pattern/localization.dart
@@ -1,4 +1,4 @@
-import 'package:scanbot_sdk/scanbot_sdk_ui_v2.dart';
+import 'package:scanbot_sdk/scanbot_sdk.dart';
Future startScanning() async {
/** Create an instance of the default configuration */
@@ -7,14 +7,18 @@ Future startScanning() async {
/** Configure the strings. */
localization.topUserGuidance = 'Localized topUserGuidance';
localization.cameraPermissionCloseButton =
- 'Localized cameraPermissionCloseButton';
+ 'Localized cameraPermissionCloseButton';
localization.completionOverlaySuccessMessage =
- 'Localized completionOverlaySuccessMessage';
+ 'Localized completionOverlaySuccessMessage';
localization.finderViewUserGuidance = 'Localized finderViewUserGuidance';
localization.introScreenTitle = 'Localized introScreenTitle';
/** Start the Text Pattern Scanner **/
- var result = await ScanbotSdkUiV2.startTextPatternScanner(configuration);
- if (result.status == OperationStatus.OK) {
- // ...
+ var result = await ScanbotSdk.textPattern.startScanner(configuration);
+ if (result is Ok