Ticket App using Laravel as Backend and Flutter as a FrontEnd.

Rajen Trivedi
3 min readJul 22, 2019

--

One of my client requested me develop an Android Application for checking the ticket at event venue using QR Code for authenticate the entry of the guest.

i choose the Flutter as a FrontEnd and Laravel as a BackEnd for the task.

its very easy to develop using both the excellent frameworks and take advantage of packages offered by both the framework. Requirement of client was very simple, they wanted QR Code(Ticket) must not be reusable.

I used simple-qrcode package to generate QR code, the code to generate QR code is as below:

1.0

Code mentioned in image 1.0 will generate a QR code with random string of 30 character for the member and save it in to the Mysql database along with an image of QR code will be saved in folder storage/qrcode_img.

1.1

Above code will authenticate the ticket if scanned code is present in Mysql database field “ticket_code” and another field “is_chacked” is 0, it will clear the ticket and update “is_chacked” field as 1, this will prevent the reuse of ticket.

Now lets move to the Flutter part of the project.

I choose qr_reader: ^0.1.3 Flutter package to read QR code of the scanned ticket, lets see the code in below image.

1.2

In above code i have declared three variables 1. data 2. ticket & 3. url., here variable data will store the response from backend, ticket will store the scanned ticket code & url to communicate with backend.

1.3

Above code will communicate with backend and check the status of ticket if server response is ‘approved’ it will flash an success alert dialog, code for alert dialog is mentioned in below image.

1.4

And if server response is “reject” alert dialog of failed authentication will flash, code of this alert dialog is as below.

1.5

Its working fine and my client is happy with the code.

I will upload the code on GitHub.

Thanks for reading, all the suggestions are most welcome.

--

--