Back

[SOLVED] The name 'Account' is defined in the libraries

  • 0
  • Flutter
  • Accounts
Maniac_Fighter
7 Mar, 2023, 12:53

You don't need this

TL;DR
There was an issue with the name 'Account' being defined in the libraries. The solution involved understanding that a Service is a class used to make API calls, while a Model is an object that holds data. The user was provided with a resource to review and it was suggested to remove unnecessary imports or add prefixes to model imports to avoid ambiguity. The error message was requested to be shared for further assistance. It was also mentioned that the 'appwrite' package was already added and not needed.
dammy
7 Mar, 2023, 12:54

Added appwrite already @Maniac_Fighter

Maniac_Fighter
7 Mar, 2023, 12:55

umm, So the error says it's already defined. Did you made your own defination?

Maniac_Fighter
7 Mar, 2023, 12:55

The error would show that where its defined

dammy
7 Mar, 2023, 13:04

No I didn't

Maniac_Fighter
7 Mar, 2023, 13:06

Could you please share the screenshot of the error

dammy
7 Mar, 2023, 13:08

Here it is

Maniac_Fighter
7 Mar, 2023, 13:10

Oh. So yess, ambuiguity is expected here. you can add prefix in model imports, or if you aren't using models for now, you can remove them

dammy
7 Mar, 2023, 13:11

but the models will be needed later for documents though

how do I overcome that later on

Maniac_Fighter
7 Mar, 2023, 13:12

as said you can do this package:appwrite/models.dart as models and whenever you need Account from models do this models.Account

dammy
7 Mar, 2023, 13:12

okay

dammy
7 Mar, 2023, 13:13

It means two different kinds of Accounts right?

cause after adding model, the error didn't resurface

Maniac_Fighter
7 Mar, 2023, 13:16

So there are two Accounts One Account (https://github.com/appwrite/sdk-for-flutter/blob/e5236a1375875f176937392360c6864888efb677/lib/services/account.dart) which does all the necessary calls for you like createAccount, getAccount etc

The Other Account is the response Model(https://github.com/appwrite/sdk-for-flutter/blob/91b9d02d45eb58aefae43f4e82c7d03fafd4809e/lib/src/models/account.dart)

This is being returned when you usually call account.get

dammy
7 Mar, 2023, 13:16

Okay then

I'll check for all

dammy
7 Mar, 2023, 13:17

I'm super grateful @Maniac_Fighter I really appreciate your efforts and time spent. Thank you so much.

dammy
7 Mar, 2023, 13:21

Ooooo

Wonderful, I'm beginning to understand it now

Drake
7 Mar, 2023, 17:25

[SOLVED] The name 'Account' is defined in the libraries

dammy
10 Mar, 2023, 22:18

The name 'Account' is defined in the libraries

dammy
10 Mar, 2023, 22:18

@Maniac_Fighter still on it

Drake
10 Mar, 2023, 22:27

what do you mean?

dammy
10 Mar, 2023, 22:28

He gave some resource to use. But I could not figure out solution

Drake
10 Mar, 2023, 22:44

@dammy to clarify further, a Service is a class used to make API calls. a Model is an object that holds data. does that make sense?

dammy
10 Mar, 2023, 22:51

yes @Steven

that means the creation of service is like a platform to which api calls can be initiated while the model holds data to be used or something related

dammy
11 Mar, 2023, 01:44

[SOLVED] The name 'Account' is defined in the libraries

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more