Duplicate Classes Error when using same library in Flutter project and Unity Exported Project

429 views Asked by At

Let me explain my problem in more detail. I have implemented the Agora library in Flutter and the unity project as well. Below is the link to libraries.

Flutter Lib: https://pub.dev/packages/agora_rtc_engine

Unity Agora Lib: https://assetstore.unity.com/packages/tools/video/agora-video-sdk-for-unity-134502

Unity Project having a .jar file of agora-rtc-engine and flutter is also using the same library inform of dependency.

Now, When I build the project it gives me the duplicate classes error because both platform projects having the same library.

One solution that I was trying to apply was to create a separate submodule project of the agora library and used that project in both the flutter and unity module. while I can apply this solution if I am developing an android native app, In the flutter app, I am using the library via pubSpec so it creates its own platform-specific android project in the build where I can not modify the android project.

Is there any way to combine the flutter third-party project that will use the android project's submodule rather than using its own library?

I am looking for a solution for many days if anybody has any solution please let me know. or Am I doing anything wrong to use unity exported project in flutter application?

If you have any other solution than this please share it.

1

There are 1 answers

0
Abhishek Ghaskata On

you can import along with alias name.

import 'package:http/http.dart' as http;

to use some methods like

http.Response response = await http.get(
      EndPoint.Book,
    );

use the same mechanism for agora and unity package.