0

enter image description hereI am learning Dart on Flutter. I am trying to display an image from a URL using NetworkImage('URL'), but the picture is not displayed on my emulator, here is my code:

import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';

void main() => runApp(MaterialApp(home: Test()));

class Test extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('This is a title.'),
        centerTitle: true,
        backgroundColor: Colors.red,
      ),
      body: Center(
        child: Image(
            image: NetworkImage(
            'https://cdn.pixabay.com/photo/2017/09/25/13/12/dog-2785074_960_720.jpg'),),
      ),
      floatingActionButton: FloatingActionButton(
        child: Text('Click'),
        onPressed: () {},
        backgroundColor: Colors.teal[900],
      ),
    );
  }
}

What am I doing wrong?

Here is the error log: enter image description here

Mehdi RH
  • 322
  • 1
  • 7
  • 18

1 Answers1

0

After some research, I found the solution to my problem. Apparently, having LAN card enabled while you are on a Wifi network is the source of the problem. I had to disable every network adapter that is not used except for my wireless card, and voilà. Thank you, everyone, for taking the time to look into this problem, I hope this might help someone with the same problem.

Mehdi RH
  • 322
  • 1
  • 7
  • 18