'how to fix error DevFS synchronization failed when installing flutter SVG package?

I got this flutter_SVG package

updated pubspec.yaml as below

    dependencies:
  flutter:
    sdk: flutter

  cupertino_icons: ^0.1.3
  flutter_svg: ^0.17.4

clicked the pub get button and done properly

I confirmed that my SVG file is properly put in under assets in the pubspec.yaml

then in Home.dart where I want, I imported the package normally, and below is the code where the svg should work as per package readme instructions

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

class HomeState extends State<Home> {
  TextEditingController _foo = new TextEditingController();


  Widget build(BuildContext context) {

    const pyramidsYellowIcon = 'my_assets/icons/pyramids_yellow.svg';
    const followIconOffIcon = 'my_assets/icons/follow_icon_off.svg';

    return Stack(

          children: <Widget>[

            Container(                                   
              child: SvgPicture.asset(followIconOffIcon, semanticsLabel: 'follow',),
            ),
            
          ],
          
        ),
    
  }
}

then a hot reload error shows DevFS synchronization failed

and below logcat shows

2020-07-02 12:43:21.375 3019-3019/? E/GmsClientSupervisor: Timeout waiting for ServiceConnection callback com.google.android.gms.clearcut.service.START
java.lang.Exception
    at tlk.handleMessage(PG:6)
    at android.os.Handler.dispatchMessage(Handler.java:98)
    at tzg.a(PG:5)
    at tzg.dispatchMessage(PG:4)
    at android.os.Looper.loop(Looper.java:154)
    at android.app.ActivityThread.main(ActivityThread.java:6119)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

any, of course, the emulator refuses to reload, when I delete all changes mentioned above, everything is fixed and normal



Solution 1:[1]

After you add a package or an asset the hot reload doesn't work. You have to restart the app.

Solution 2:[2]

In my case I got error message "Hot Restart Error DevFS synchronization failed".

I had to stop an application in Android Studio (Run > Stop) and then run again (Run > Run...). Also there was an error in code that I fixed.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 CoolMind