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
Devaka Cooray
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Jeanne Boyarsky
Tim Cooke
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Tim Moores
Mikalai Zaikin
Carey Brown
Bartenders:
Forum:
Android
flutter cannot get value from async
gong tji
Ranch Hand
Posts: 97
posted 2 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 2 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
Bring out your dead! Or a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
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...