sc4v3ng3r / flutter_audio_query

Flutter Audio Query Plugin
https://pub.dev/packages/flutter_audio_query
MIT License
52 stars 48 forks source link

The getter 'bloc' was called on null #48

Open kamleshwebtech opened 3 years ago

kamleshwebtech commented 3 years ago

Getting error at the time of compilation:

════════ Exception caught by widgets library ═══════════════════════════════════ The following NoSuchMethodError was thrown building MainScreen(dirty, state: _MainScreenState#4057c): The getter 'bloc' was called on null. Receiver: null Tried calling: bloc

The relevant error-causing widget was MainScreen lib\main.dart:18 When the exception was thrown, this was the stack

0 Object.noSuchMethod (dart:core-patch/object_patch.dart:51:5)

1 BlocProvider.of

package:flutter_audio_query_example/…/bloc/BlocProvider.dart:21

2 _MainScreenState.build

package:flutter_audio_query_example/…/screens/MainScreen.dart:46

3 StatefulElement.build

package:flutter/…/widgets/framework.dart:4744

4 ComponentElement.performRebuild

any suggestion?? Please share. Thanks.

neetu2004 commented 3 years ago

Extend MaterialApp widget with Provider. example: Widget build(BuildContext context) { return Provider( child: MaterialApp( home: MyApp(), ), ); }