Barcode item scan.

Hey guys having some trouble with the barcode how can I get it so when it scans a item. I have it where when it scans a item it goes to the api we made then a informational dialog will pop up to alert them they scanned an item but now how can I get it to where if someone clicks add item it will add it like a list to a page as a item scanned?

That's where I'm drawing a blank and wondering if anyone can point me in good direction to maybe see if there is a way of doing this in Flutter flow? Here is the code:

import 'dart:convert';

dynamic parseJSON(String jsonString) {
  // parse a JSON string and return the parsed json
  dynamic parsedJson = json.decode(jsonString);
  return parsedJson;
}


String getProductFromJSON(dynamic jsonData) {
  // return a placeholder string
  return jsonData["title"];
}


void main() {
  String jsonString = "{\"title\": \"American Metalcraft CAR11HC - Pizza Pan, 11\\\" Dia., 11 16\\\" Deep, Car Pan with Hard Coat, Solid\", \"imgUrl\": \"https://images.barcodelookup.com/8471/84718033-1.jpg\", \"description\": \"Pizza Pan, 11\\\" Dia., 11/16\\\" Deep, Car Pan With Hardcoat, Solid CAR pans are made without a rolled edge. The top edge is left unfinished and may be sharp so it can cut dough. Sheeted dough can be placed over the pan and then cut off with a rolling pin or pie roller. CAR HC Hard Coat Anodized 14 ga., 1.5 mm Aluminum 11\\\" Top OD, 10\\\" Bottom ID, 11/16\\\" Deep (27.9 x 25.4 x 1.7 cm).\", \"category\": \"Business & Industrial \"}";
  
  dynamic decoded = parseJSON(jsonString);
  String title = getProductFromJSON(decoded);
  
  print(title);
}



NavBar.png
38.28KB

Here is the nav bar so when the app opens and you scan something it just scans then goes back to the home-screen here is a image of how everything is setup. The dialog box doesn't even show up anymore which is odd because when I removed 5 it shows up but when I add it back to pull the title the dialog box doesn't show.

Action setup.png
27.74KB

If anyone has a solution to either having the dialog box pop up and then there being a button to add it to the page or just have it where when they scan a item it gets added to the list page. open to ideas looking to learn here. Also please ask if you need more clarification on anything really trying to get this to work I'm really close.

1
1 reply