A template that enables fluter software to be locked to a single machine for software sales or copy protection.
It currently utilises the device_info_plus
package to get the relevant hardware ID, regardless of platform.
I would recommend NOT utilising the entire project as a template as there are references to "spusuf_template" as the project name in multiple locations. With that said, this project (if pulled entirely) should display and check against a hardware ID and return the flutter default app in the home.dart file.
I would recommend creating a project using flutter create
then adding device_info_plus
to the pubspec.yaml
in the "dependencies" section, then copying and adapting the contents of the lib
folder. This includes setting which check mode you would like to use (and deleting the unused code), see modes.
License check modes. In the 'main.dart' file there is a switch that runs a license check in one of many ways.
Mode 1 utilises a hardware ID as a string in your code.
This is acceptable for development, or deploying to one hardware device (such as an embedded device to be shipped out).
Displays the user's hashed hardware ID, waits for a response key (encoded key with a known cipher that is baked into the code).
This response cipher can be manually generated or automatically generated by a website/server. This can be a one-time purchase (e.g purchase every time you want a repsonse), time-limited validity key (e.g 1 year license), or rate-limited key (e.g 1 per IP per month).
This can be manually entered by the user in a text field, placed in a key file on the device, stored in persistent storage, or automatically fetched using a backend server.
Make sure the key is tied to the user account in a database for good customer experience in case of data loss/cleared persistance/uninstall/update.
Mode 2 utilises flutter's build time variable (baking the hardware ID into the release build process).
This uses --dart-define
during the flutter build
process