import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/basic.dart';
void main() {
runApp(
MaterialApp(
home: Scaffold(
backgroundColor: Colors.blueGrey,
appBar: AppBar(
backgroundColor: Colors.blueGrey[900],
title: Text("I AM RICH"),
),
body: Center(
child:Image(
image: NetworkImage('https://images.pexels.com/photos/462118/pexels-photo-462118.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500'),
),
),
),
debugShowCheckedModeBanner: false,
)
);
}
They are different. NetworkImage class creates an object the provides an image from the src URL passed to it. It is not a widget and does not output an image to the screen. Image.network creates a widget that displays an image on the screen. It is just a named constructor on the Image class(a stateful widget).
In debug mode service extension and multiple permissions are enabled by default(in flutter)
as you are in release mode you have to add internet permission in androidmanifest.xml manually.( Just like you add it in native development)
navigate to android-> app-> src-> main-> AndroidManifest.xml and add this line outside of application scope.
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With