admin 管理员组文章数量: 1086019
I'm using clerk_flutter: ^0.0.8-beta
authentication for the app I'm building. What I'm trying to do is simple: sign up a user, and display a homepage if successful.
Here's the main.dart file:
import 'package:app_frontend/example.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter App',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const ExampleApp(
publishableKey:
"**clerk_publishable_key_here**",
),
);
}
}
And here's the example.dart file, slightly modified from the one in pub.dev
import 'package:clerk_flutter/clerk_flutter.dart';
import 'package:flutter/material.dart';
class ExampleApp extends StatelessWidget {
const ExampleApp({super.key, required this.publishableKey});
final String publishableKey;
@override
Widget build(BuildContext context) {
return ClerkAuth(
config: ClerkAuthConfig(publishableKey: publishableKey),
child: SafeArea(
child: ClerkErrorListener(
child: ClerkAuthBuilder(
signedInBuilder: (context, authState) {
return const Center(
child: Text("Homepage"),
);
},
signedOutBuilder: (context, authState) {
return const ClerkAuthentication();
},
),
),
),
);
}
}
I've got the flutter signup widget on my device, but when I try to sign up with Google, I get the following error in Android Studio:
======== Exception caught by widgets library ======================================================= The following assertion was thrown building Builder: No 'ClerkAuth' found in context 'package:clerk_flutter/src/widgets/control/clerk_auth.dart': Failed assertion: line 56 pos 12: 'result != null'
I thought at first it may have been caused by me stacking the Clerk and main.dart file's MaterialApp widget. That wasn't it. I haven't found too many examples done with this package except the one from pub.dev.
I also inspected the ClerkAuth
and ClerkAuthState
objects in the documentation, but I couldn't solve my problem. Anyone who can better understand the documentation?
本文标签: Flutter with ClerkquotNo ClerkAuth found in contextquotStack Overflow
版权声明:本文标题:Flutter with Clerk -- "No `ClerkAuth` found in context" - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://roclinux.cn/p/1744047345a2524370.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论