[Problem/Question]
When using the SendbirdUIKit.provider
method in Flutter alongside a MaterialApp.router
constructor (which is required when using a routing package such as the officially recommended go_router
package), I get this error:
FlutterError (No Directionality widget found.
_Theater widgets require a Directionality widget ancestor.
The specific widget that could not find a Directionality ancestor was:
_Theater
The ownership chain for the affected widget is: "_Theater ← Overlay ← _FToastHolder ← Builder ← _InheritedProviderScope<SBUMessageCollectionProvider?> ← ChangeNotifierProvider ← _NestedHook ← _InheritedProviderScope<SBUGroupChannelCollectionProvider?> ← ChangeNotifierProvider ← _NestedHook ← ⋯"
Typically, the Directionality widget is introduced by the MaterialApp or WidgetsApp widget at the top of your application widget tree. It determines the ambient reading direction and is used, for example, to determine how to lay out text, how to interpret "start" and "end" values, and to resolve EdgeInsetsDirectional, AlignmentDirectional, and other *Directional objects.)
// If problem, please fill out the below. If question, please delete.
// What version of the SDK are you using?
sendbird_uikit 1.0.0
[Reproduction Steps]
Just wrap the UIKit provider along a MaterialApp widget:
class MainApp extends StatelessWidget {
const MainApp({super.key});
@override
Widget build(BuildContext context) {
return SendbirdUIKit.provider(
child: MaterialApp(
home: Scaffold(
body: Center(
child: Text('Hello World!'),
),
),
));
}
}
[Frequency]
Always
[Current impact]
Can’t use the SDK if I have a crash when launching the app.