Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flutter 集成 #45

Open
ZhangX-Byte opened this issue Jul 21, 2024 · 1 comment
Open

flutter 集成 #45

ZhangX-Byte opened this issue Jul 21, 2024 · 1 comment

Comments

@ZhangX-Byte
Copy link

ZhangX-Byte commented Jul 21, 2024

`
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart';

class MessagePage extends StatefulWidget {
const MessagePage({super.key});

@OverRide
State createState() => _MessagePageState();
}

class _MessagePageState extends State {
final CoreServicesImpl _coreInstance = TIMUIKitCore.getInstance();

@OverRide
void initState() {
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) async {});
_coreInstance.init(
sdkAppID: 0,
// Replace 0 with the SDKAppID of your IM application when integrating
// language: LanguageEnum.en, // 界面语言配置,若不配置,则跟随系统语言
loglevel: LogLevelEnum.V2TIM_LOG_DEBUG,
onTUIKitCallbackListener: (TIMCallback callbackValue) {},
// 建议配置,详见此部分
listener: V2TimSDKListener());
super.initState();
}

@OverRide
Widget build(BuildContext context) {
return Container();
}
}
`

报错

`Launching lib/main.dart on Chrome in debug mode...
Waiting for connection from debug service on Chrome...
../../../../.pub-cache/hosted/pub.dev/tencent_cloud_chat_uikit-2.6.0+2/lib/ui/views/TIMUIKitConversation/tim_uikit_conversation.dart:163:5: Error: The getter 'model' isn't defined for the class '_TIMUIKitConversationState'.

  • '_TIMUIKitConversationState' is from 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitConversation/tim_uikit_conversation.dart' ('../../../../.pub-cache/hosted/pub.dev/tencent_cloud_chat_uikit-2.6.0+2/lib/ui/views/TIMUIKitConversation/tim_uikit_conversation.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'model'.
    model.setSelectedConversation(conversation);
    ^^^^^
    ../../../../.pub-cache/hosted/pub.dev/tencent_cloud_chat_uikit-2.6.0+2/lib/ui/views/TIMUIKitConversation/tim_uikit_conversation.dart:179:57: Error: The getter 'model' isn't defined for the class '_TIMUIKitConversationState'.
  • '_TIMUIKitConversationState' is from 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitConversation/tim_uikit_conversation.dart' ('../../../../.pub-cache/hosted/pub.dev/tencent_cloud_chat_uikit-2.6.0+2/lib/ui/views/TIMUIKitConversation/tim_uikit_conversation.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'model'.
    List<V2TimConversation?> filteredConversationList = model.conversationList.where((element) => (element?.groupID != null || element?.userID != null)).toList();
    ^^^^^
    ../../../../.pub-cache/hosted/pub.dev/tencent_cloud_chat_uikit-2.6.0+2/lib/ui/views/TIMUIKitConversation/tim_uikit_conversation.dart:237:19: Error: The getter 'themeViewModel' isn't defined for the class '_TIMUIKitConversationState'.
  • '_TIMUIKitConversationState' is from 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitConversation/tim_uikit_conversation.dart' ('../../../../.pub-cache/hosted/pub.dev/tencent_cloud_chat_uikit-2.6.0+2/lib/ui/views/TIMUIKitConversation/tim_uikit_conversation.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'themeViewModel'.
    final theme = themeViewModel.theme;
    ^^^^^^^^^^^^^^
    ../../../../.pub-cache/hosted/pub.dev/tencent_cloud_chat_uikit-2.6.0+2/lib/ui/views/TIMUIKitConversation/tim_uikit_conversation.dart:290:57: Error: The getter 'model' isn't defined for the class '_TIMUIKitConversationState'.
  • '_TIMUIKitConversationState' is from 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitConversation/tim_uikit_conversation.dart' ('../../../../.pub-cache/hosted/pub.dev/tencent_cloud_chat_uikit-2.6.0+2/lib/ui/views/TIMUIKitConversation/tim_uikit_conversation.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'model'.
    providers: [ChangeNotifierProvider.value(value: model), ChangeNotifierProvider.value(value: friendShipViewModel)],
    ^^^^^
    ../../../../.pub-cache/hosted/pub.dev/tencent_cloud_chat_uikit-2.6.0+2/lib/ui/views/TIMUIKitConversation/tim_uikit_conversation.dart:290:44: Error: Inferred type argument 'dynamic' doesn't conform to the bound 'ChangeNotifier?' of the type variable 'T' on 'ChangeNotifierProvider'.
  • 'ChangeNotifier' is from 'package:flutter/src/foundation/change_notifier.dart' ('/opt/homebrew/Caskroom/flutter/3.19.2/flutter/packages/flutter/lib/src/foundation/change_notifier.dart').
    Try specifying type arguments explicitly so that they conform to the bounds.
    providers: [ChangeNotifierProvider.value(value: model), ChangeNotifierProvider.value(value: friendShipViewModel)],
    ^
    ../../../../.pub-cache/hosted/pub.dev/provider-6.1.2/lib/src/change_notifier_provider.dart:98:30: Context: This is the type variable whose bound isn't conformed to.
    class ChangeNotifierProvider<T extends ChangeNotifier?>
    ^
    ../../../../.pub-cache/hosted/pub.dev/tencent_cloud_chat_uikit-2.6.0+2/lib/ui/views/TIMUIKitConversation/tim_uikit_conversation.dart:327:76: Error: The getter 'model' isn't defined for the class '_TIMUIKitConversationState'.
  • '_TIMUIKitConversationState' is from 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitConversation/tim_uikit_conversation.dart' ('../../../../.pub-cache/hosted/pub.dev/tencent_cloud_chat_uikit-2.6.0+2/lib/ui/views/TIMUIKitConversation/tim_uikit_conversation.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'model'.
    final isCurrent = conversationItem.conversationID == model.selectedConversation?.conversationID;
    ^^^^^
    ../../../../.pub-cache/hosted/pub.dev/tencent_cloud_chat_uikit-2.6.0+2/lib/ui/views/TIMUIKitConversation/tim_uikit_conversation.dart:394:21: Error: The getter 'model' isn't defined for the class '_TIMUIKitConversationState'.
  • '_TIMUIKitConversationState' is from 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitConversation/tim_uikit_conversation.dart' ('../../../../.pub-cache/hosted/pub.dev/tencent_cloud_chat_uikit-2.6.0+2/lib/ui/views/TIMUIKitConversation/tim_uikit_conversation.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named 'model'.
    model.refresh();
    ^^^^^
    Failed to compile application.
    `
@ZhangX-Byte
Copy link
Author

使用 flutter Provider

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant