Unable to load assets "assets/images/me.png" flutter using dart framework

14 Views Asked by At

[1. create directory : "assets" 2. create directory images inside "assets" and then put in image into it "me.png"

  1. modify pubspec.ymal : flutter: uses-material-design: true assets:

`

import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: SafeArea(
        child: Scaffold(
          backgroundColor: Colors.blue,
          body: Center(
            child: Image.asset('assets/images/me.png'),
          ),
        ),
      ),
    );
  }
}
0

There are 0 best solutions below