Reputation: 91
I have an huge error when I try loading images from an url in flutter. I have uploaded it to hastebin: https://hastebin.com/iguvopihog.m
Here is my code:
import 'package:flutter/material.dart';
import 'package:test/news.dart';
void main() => runApp(new Main());
class Main extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: 'Test',
home: new Scaffold(
body: new Image.network('www.google.de/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png'),
appBar: new AppBar(
title: new Text("Test"),
actions: <Widget>[
new IconButton(icon: new Icon(Icons.menu), onPressed: null),
],
),
),
);
}
}
Upvotes: 9
Views: 15527
Reputation: 657957
For some reason Image.network
seems to interpret the URL as file path.
Try instead setting the protocol explicitely:
body: new Image.network('http://www.google.de/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png'),
Upvotes: 23