I need help finishing this flutter code, please, please! I can provide more code details if needed I need the stock name
Posted: Thu Jun 02, 2022 7:46 am
I need help finishing this flutter code, please, please! I can
provide more code details if needed
I need the stock name and price to display the value from API
after the user input the name of the code in the show dialog
box.
I did already fetch the API using Future getQuote
please let me know
thank you
contentPadding: Edgeinsets.all 5.0, content: TextField( decoration: Input Decoration (hintText: "Symbol"), onChanged: (String value) { _stockSymbol = value; }, ), // TextField actions: <Widget>[ TextButton( child: const Text ("Add Stock"), onPressed: () async { if (_stockSymbol.isNotEmpty) { print('User entered Symbol: $_stockSymbol'); try { //TODO: //Inside of this try, //get the stock data with stockService.getQuote //but remember you must use await, //then if it is not null, //dig out the symbol, companyName, and latestPrice, //then create a new object of //type Stock and add it to //the database by calling //_databaseService.insertStock, //then get all the stocks from //the database with //_databaseService.getAllStocksFromDb and //attach them to _stockList, //then print all stocks to the console and, //finally call setstate at the end. await _stockService.getQuote( _stockSymbol, ); if (_stockSymbol != null) { B You, now. Uncommitted changes await _databaseService.insertStock(Stock( symbol: _stockSymbol.toUpperCase(), name: price: 5)); // Stock = _stockList await _databaseService.getAllStocks FromDb(); _databaseService.printAllStocks InDbToConsole(); setState(() {}); print('${_inputStock} helloooo'); } catch (e) { print('HomeView_inputStock catch: $e'); }
provide more code details if needed
I need the stock name and price to display the value from API
after the user input the name of the code in the show dialog
box.
I did already fetch the API using Future getQuote
please let me know
thank you
contentPadding: Edgeinsets.all 5.0, content: TextField( decoration: Input Decoration (hintText: "Symbol"), onChanged: (String value) { _stockSymbol = value; }, ), // TextField actions: <Widget>[ TextButton( child: const Text ("Add Stock"), onPressed: () async { if (_stockSymbol.isNotEmpty) { print('User entered Symbol: $_stockSymbol'); try { //TODO: //Inside of this try, //get the stock data with stockService.getQuote //but remember you must use await, //then if it is not null, //dig out the symbol, companyName, and latestPrice, //then create a new object of //type Stock and add it to //the database by calling //_databaseService.insertStock, //then get all the stocks from //the database with //_databaseService.getAllStocksFromDb and //attach them to _stockList, //then print all stocks to the console and, //finally call setstate at the end. await _stockService.getQuote( _stockSymbol, ); if (_stockSymbol != null) { B You, now. Uncommitted changes await _databaseService.insertStock(Stock( symbol: _stockSymbol.toUpperCase(), name: price: 5)); // Stock = _stockList await _databaseService.getAllStocks FromDb(); _databaseService.printAllStocks InDbToConsole(); setState(() {}); print('${_inputStock} helloooo'); } catch (e) { print('HomeView_inputStock catch: $e'); }