'Assertion failed: C:\…\src\provider.dart:330 T == dynamic "Tried to call Provider.of<dynamic>

i keep getting this error..I am using latest version of flutter ,dart,and provider 6.0.2...even if just try to pass a string i get this error..

Exception caught by widgets library ═══════════════════════════════════ The following assertion was thrown building Homepage(dirty): Assertion failed: C:\…\src\provider.dart:330 T == dynamic "Tried to call Provider.of. This is likely a mistake and is therefore\nunsupported.\n\nIf you want to expose a variable that can be anything, consider changing\ndynamic to Object instead.\n"



Solution 1:[1]

Try the below code this may help according to the above-mentioned Provider.

future: Provider.of<CLASSNAME>(context, listen: false).auth.getCurrentUid(),

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 rkumar1904