Home > OS >  Flutter svg issue
Flutter svg issue

Time:09-07

I installed flutter svg package and first my svg was shown. Now it shows error as below. Does someone knows how to solve this issue?

Failed to detect image file format using the file header. File header was [0x3c 0x3f 0x78 0x6d 0x6c 0x20 0x76 0x65 0x72 0x73]. Image source: encoded image bytes

my code:::::

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

class navigationBar extends StatelessWidget {
  const navigationBar({ Key? key}) : super(key: key);
  
  @override
  Widget build(BuildContext context) {
    return Container(
      height: 100,
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceEvenly,
        children: <Widget>[
          SizedBox(
            height: 80,
            width: 150,
            child: Image.asset('assets/LechnerShops_icon_email.svg'),
          ),
          Row(
            mainAxisSize: MainAxisSize.min,
            children: <Widget>[
              _NavBarItem('Episodes'),
              SizedBox(
                width: 60,
              ),
              _NavBarItem('About'),
            ],
          )
        ],
      ),
    );
  }
}

CodePudding user response:

with flutter_svg package you should use SvgPicture

SvgPicture.asset('assets/LechnerShops_icon_email.svg'),
  • Related