# How to Use?
1. New a Project
- Create a Flutter Plugin project using Android Studio or other development tools.
2. Include 3rd-Party Libraries
- Import the SDK and .h file into the "flutter_tunnel.podspec",and copy it to the corresponding folder directory.
> Note: When compiling, it is necessary to include the "libz.tbd" library in the ".xcodeproject".
- Import the SDK file into the "build.gradle" file and copy it to the corresponding folder directory.
- The "flutter_tunnel.dart" file contains calls to implement Tunnel related APIs, and the UI layer can call methods of this calss.
- In the local Flutter project, import flutter_tunnel plugin
4. How to demo?
![Flutter SDK_230915](https://www.showdoc.com.cn/server/api/attachment/visitFile?sign=55234a4bcdbe77eadc49c8c353b34925&file=file.png "Flutter SDK_230915")
IOS Installation Guide
- System requirements: IOS 10.0 and above.
Method One： a. Use the mobile phone system scanning tool (wechat or Alipay scanning is not supported for now); b. Scan the QR code above to get the download link address; c. The mobile phone can automatically identify the download address and pop up an installation prompt dialog box; d. Click "Install" and wait for the app installation to complete.
Method Two： a. Use a third-party code scanning tool (wechat or Alipay scanning is not supported for now); b. Scan the QR code above to get the download link address; c. Click the link, or paste the download link address into the Safari browser and go, a prompt pops up: "Open the link in 'iTunes'?" d. Click "Open", and the installation prompt dialog box will pop up; e. Click "Install" and wait for the app installation to complete.
- When starting the app for the first time, if you encounter the prompt "Untrusted Enterprise Developer", please do the following: a. Enter the mobile phone system settings, click "General"; b. Find “Device Management” and check it, click “Throughtek Co., Ltd.”; c. After clicking Trust “Throughtek Co., Ltd.”, restart the application.
Android Installation Guide
- System requirements: Android 7.0 and above. a. Use browser scanning tools, or third-party scanning tools (wechat or Alipay scanning is not supported for now); b. Scan the QR code above to get the download link address; c. Click the link, or paste the download link address into the browser and open it; d. After clicking "Download", enter the browser download interface to check the progress and wait for the download to complete; e. Click "Install" and complete the installation steps according to the operation of the mobile phone.
> Note: The detailed operation steps are still subject to the behavior of the third-party scanning tool/browser/mobile phone system actually used, and the above is only for reference.
Call API Steps
- Step1. Call TK_initSDK Success(return code 0);
- Step2. Call TK_tunnelConnect Success(return code 0);
- Step3. Call TK_startPortMapping Success(return code 0);
- Step4. Make Sure the ip:localport setting in the sample code,and try to copy the url（such as http://127.0.0.1:10000/nas ） to the browser，data access successful;
- Step5. Call TK_stopPortMapping(return code 0) to exit port mapping setting;
- Step6. Call TK_disconnectTunnel(return code 0) to exit the tunnel connection;
- Step7. Call TK_unInitThunnel(return code 0) to uninitial IOTC Module;
> Note: If return error code when call api, your can refer the readme file in standard SDK to check the abnormal situation.
- Flutter Compilation Environment
- Flutter 2.10.1
- Tools • Dart 2.16.1 • DevTools 2.9.2