기본 사용

../my_icon.png
../2.0x/my_icon.png
../3.0x/my_icon.png

로컬 이미지 표시

# To add assets to your application, add an assets section, like this:
# assets:
#   - images/a_dot_burr.jpeg
#   - images/a_dot_ham.jpeg

-> 아래와 같이 변경

# To add assets to your application, add an assets section, like this:
assets:
  - assets/bunny.gif
  - assets/profile.png

# 폴더 지정
assets:
	- assets/
import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      debugShowCheckedModeBanner: false,
      home: Home(),
    );
  }
}

class Home extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Image'),
      ),
      body: Center(
        child: Image(image: AssetImage('assets/profile.png')),
				// 로컬 이미지 표시
      ),
    );
  }
}

# 사용법 1
Image(
  image: AssetImage('assets/profile.png'),
  width: 200,
  height: 100,
  fit: BoxFit.fill,
)

# 사용법 2
Image.asset('assets/profile.png')

# 사용법 3
Image.asset(
  'assets/profile.png',
  width: 200,
  height: 100,
  fit: BoxFit.fill,
)

네트워크 이미지

# 사용법 1
Image(
  image: NetworkImage(
    '<https://flutter.github.io/assets-for-api-docs/assets/widgets/owl.jpg>',
  ),
),

# 사용법 2
Image(
  image: NetworkImage(
    '<https://flutter.github.io/assets-for-api-docs/assets/widgets/owl.jpg>',
  ),
  width: 200,
  height: 100,
  fit: BoxFit.fill,
),

# 사용법 3
Image.network(
  '<https://flutter.github.io/assets-for-api-docs/assets/widgets/owl.jpg>',
)

# 사용법 4
Image.network(
  '<https://flutter.github.io/assets-for-api-docs/assets/widgets/owl.jpg>',
  width: 200,
  height: 100,
  fit: BoxFit.fill,
),