While Posting data on realtime database.. everything is fine when i add data in my local list but cant post in database. here is my code:

void addTask(String newTaskTitle){
final task = Task(title: newTaskTitle);
const Url = 'my url/tasks.json'; // added correct url but hiding here
http.post(Url, body: json.encode({
  'title': task.title,
  'id': task.id,
}),).then((response) {

error log : Unhandled Exception: SocketException: Failed host lookup: 'url' (OS Error: No address associated with hostname, errno = 7)

Solution 1: griffins

Make sure you are online either it is mobile or emulator Make sure you have given internet permission in your app's AndroidManifest.xml

    <uses-permission android:name="android.permission.INTERNET"/>