{"id":30808631,"url":"https://github.com/easemob/im_flutter_sdk_oh","last_synced_at":"2025-10-04T06:06:54.355Z","repository":{"id":279362593,"uuid":"936405218","full_name":"easemob/im_flutter_sdk_oh","owner":"easemob","description":"IM Flutter SDK Open Harmony","archived":false,"fork":false,"pushed_at":"2025-03-12T08:12:44.000Z","size":48687,"stargazers_count":1,"open_issues_count":1,"forks_count":3,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-03-12T08:33:36.903Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/easemob.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-21T03:00:49.000Z","updated_at":"2025-03-07T06:55:11.000Z","dependencies_parsed_at":"2025-03-04T08:19:35.631Z","dependency_job_id":null,"html_url":"https://github.com/easemob/im_flutter_sdk_oh","commit_stats":null,"previous_names":["easemob/im_flutter_sdk_oh"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/easemob/im_flutter_sdk_oh","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/easemob%2Fim_flutter_sdk_oh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/easemob%2Fim_flutter_sdk_oh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/easemob%2Fim_flutter_sdk_oh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/easemob%2Fim_flutter_sdk_oh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/easemob","download_url":"https://codeload.github.com/easemob/im_flutter_sdk_oh/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/easemob%2Fim_flutter_sdk_oh/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273854786,"owners_count":25180013,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-06T02:00:13.247Z","response_time":2576,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-09-06T03:51:21.785Z","updated_at":"2025-10-04T06:06:49.336Z","avatar_url":"https://github.com/easemob.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 鸿蒙 im_flutter_sdk 快速入门\n\n当前工程支持了`ios`，`android`，`ohos` 三个平台。\n\n[flutter 鸿蒙支持环境搭建](https://gitee.com/harmonycommando_flutter/flutter)\n\n\n### 向已存在的项目中添加鸿蒙支持\n\n需要先进入到项目中，之后执行命令\n\n```shell\nflutter create  --platforms=ohos .\n```\n\n如果之前设置了org，此时可能会报org冲突，此时需要在命令中指定 org。\n\n```shell\nflutter create  --platforms=ohos . --org=\"xxx.xxx\"\n```\n\n其中 `xxx.xxx` 为您 org 的名称。\n\n\n### 新建支持鸿蒙的项目\n\n```shell\nflutter create new_project_name --org=\"xxx.xxx\" --platforms=ios,android,ohos\n```\n\n### 添加 im_flutter_sdk\n\n在工程的 `pubspec.yaml` 中添加 sdk 依赖。\n\n```shell\nim_flutter_sdk:\n    git:\n        url: \"https://github.com/easemob/im_flutter_sdk_oh.git\"\n        ref: \"main\"\n```\n\n#### 修改 useNormalizedOHMUrl 模式\n\n因为 环信 sdk 只支持 useNormalizedOHMUrl模式，最需要在你的项目中配置 useNormalizedOHMUrl 为 `true`\n\n打开 `app/ohos/build-profile.json5` 文件，找到 `app:products:`, 并向其中添加 `buildOption`\n\n```json\n\"products\": [\n  {\n    \"name\": \"default\",\n    \"signingConfig\": \"default\",\n    \"compatibleSdkVersion\": \"5.0.0(12)\",\n    \"runtimeOS\": \"HarmonyOS\",\n    // 添加内容\n    \"buildOption\": {\n      \"strictMode\": {\n        \"useNormalizedOHMUrl\": true\n      }\n    }\n  }\n]\n```\n\n\n运行项目时需要先 build hap包。 执行\n```shell\nflutter build hap --debug\n```\n\n目前 flutter 社区版框架不支持 floatingActionButton，如果需要运行项目，要删除 floatingActionButton。\n同时，如果是模拟器运行，需要关闭 `impeller`,\n关闭方法参考 [常见问题](https://gitee.com/harmonycommando_flutter/flutter#%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98)\n\n### 打包\n\n项目打包执行 `flutter build hap --release`\n\n\n\n### 常见问题\n\n1. 在sdk初始化时增加类华为appId的传参，调用后会把appID传给鸿蒙im sdk，以便它去获取推送和绑定deviceToken。调用方式：\n\n```dart\nEMOptions options = EMOptions.withAppKey(\n    appKey,\n    extSettings: {\n      ExtSettings.kAppIDForOhOS: \"\",\n    },\n);\n```\n\n调用后sdk会自动获取deviceToken和绑定，不需要flutter层再去调用 bindDeviceToken方法了， 当然，bindDeviceToken方法依然可用，如果不想使用以上方法，可以调用bindDeviceToken。","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feasemob%2Fim_flutter_sdk_oh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feasemob%2Fim_flutter_sdk_oh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feasemob%2Fim_flutter_sdk_oh/lists"}