Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Android
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Tim Cooke
paul wheaton
Liutauras Vilda
Ron McLeod
Sheriffs:
Jeanne Boyarsky
Devaka Cooray
Paul Clapham
Saloon Keepers:
Scott Selikoff
Tim Holloway
Piet Souris
Mikalai Zaikin
Frits Walraven
Bartenders:
Stephan van Hulst
Carey Brown
Forum:
Android
flutter cannot get value from async
gong tji
Ranch Hand
Posts: 97
posted 3 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hello everyone,
I want to make simple validation to validate url through http package,
but it always return null if I call it on validation, here's my code :
Future<int> check_url(String val) async { final response = await http.get("https://www.youtube.com/oembed?url=$val&format=json"); return await response.statusCode; } int url_test(String url) { check_url(url).then((value) { return value; }); } TextFormField( decoration: InputDecoration( hintText: 'Enter text', ), textAlign: TextAlign.center, controller: test, validator: (text) { print(url_test(text)); //always return null return null; } ),
please someone help me
Thanks
Swastik Dey
Bartender
Posts: 2270
20
I like...
posted 3 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
final response = await http.get("https://www.youtube.com/oembed?url=$val&format=json");
Does the above line compile? I guess http.get takes uri as argument, but you are passing a
String
.
Swastik
The fastest and most reliable components of any system are those that are not there. Tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Better format for JSON structure?
Using jQuery + JSON + Struts to populate select options based on input textfield
struts2 + json +jquery --> cannot update variables in action class
Overwrite javascript resources
Parsing JSON jQuery object issue
More...