0
votes

I got an error for unhandled plugin exception for google_fonts and shared_preferences:

Unhandled Exception: MissingPluginException(No implementation found for method getAll on channel plugins.flutter.io/shared_preferences) Unhandled Exception: MissingPluginException(No implementation found for method getApplicationSupportDirectory on channel plugins.flutter.io/path_provider) MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:332:12) _localPath (package:google_fonts/src/file_io_desktop_and_mobile.dart:28:27)
googleFontsTextStyle (package:google_fonts/src/google_fonts_base.dart:107:3)

2
I got an error for unhandled plugin exception for google_fonts and shared_preferencesVishwesh Soni
stop your app, close vscode (or android studio) and reopen it and run pub get again, it should solve your problemDung Ngo
Thanks fro the reply but id didn't worked @DungNgoVishwesh Soni
can you also try running "flutter clean build" and re-build your appDung Ngo

2 Answers

1
votes
import androidx.annotation.NonNull
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.embedding.android.FlutterFragmentActivity
import io.flutter.plugins.GeneratedPluginRegistrant

class MainActivity: FlutterActivity() {
    override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
        GeneratedPluginRegistrant.registerWith(flutterEngine);
    }
}

By adding above code solved the problem it was suggested on GitHub link

0
votes

I'm solved with change code from mainactivity.kt or mainactivity.java.

import androidx.annotation.NonNull
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.embedding.android.FlutterFragmentActivity
import io.flutter.plugins.GeneratedPluginRegistrant

class MainActivity: FlutterFragmentActivity() {
   override fun configureFlutterEngine(@NonNull flutterEngine: 
     FlutterEngine) {
     GeneratedPluginRegistrant.registerWith(flutterEngine)
   }
}

after that, flutter clean and run