appwrite / sdk-for-dart

[READ-ONLY] Official Appwrite Dart SDK ๐Ÿ’™
https://appwrite.io
BSD 3-Clause "New" or "Revised" License
113 stars 17 forks source link

๐Ÿ› Bug Report: Getting Started in https://github.com/appwrite/sdk-for-dart contains a lot of bugs #21

Closed Tananga closed 2 years ago

Tananga commented 2 years ago

๐Ÿ‘Ÿ Reproduction steps

Open https://github.com/appwrite/sdk-for-dart and scroll to get started section. This code have a lot of bugs and its not valid dart code

import 'package:dart_appwrite/dart_appwrite.dart';

void main() async { Client client = Client(); .setEndpoint('http://[HOSTNAME_OR_IP]/v1') // Make sure your endpoint is accessible .setProject('5ff3379a01d25') // Your project ID .setKey('cd868c7af8bdc893b4...93b7535db89') .setSelfSigned() // Use only on dev mode with a self-signed SSL cert

Users users = Users(client);

try { final response = await users.create(userId: '[USER_ID]', email: โ€˜email@example.comโ€™,password: โ€˜passwordโ€™, name: โ€˜nameโ€™); print(response.data); } on AppwriteException catch(e) { print(e.message); } }

๐Ÿ‘ Expected behavior

It should work

๐Ÿ‘Ž Actual Behavior

It doesnt work

๐ŸŽฒ Appwrite version

Version 0.10.x

๐Ÿ’ป Operating system

MacOS

๐Ÿงฑ Your Environment

No response

๐Ÿ‘€ Have you spent some time to check if this issue has been raised before?

๐Ÿข Have you read the Code of Conduct?

2002Bishwajeet commented 2 years ago

Can you share the stack trace of what's not working??

Tananga commented 2 years ago

This whole example section of code which is inside readme file is not a valid Dart code.

2002Bishwajeet commented 2 years ago

Okay, I see what's the issue. it should be

Client client = Client()
.setEndpoint('http://[HOSTNAME_OR_IP]/v1') // Make sure your endpoint is accessible
.setProject('5ff3379a01d25') // Your project ID
.setKey('cd868c7af8bdc893b4...93b7535db89')
.setSelfSigned() // Use only on dev mode with a self-signed SSL cert

and not the one's in readme. I will drop a PR for this soon.

Till that time, I would recommend follow from the appwrite docs

Tananga commented 2 years ago

Thanks for help!

2002Bishwajeet commented 2 years ago

This issue has been fixed. You can close this now

Tananga commented 2 years ago

@2002Bishwajeet This code is still not valid.

Client client = Client(); .setEndpoint('http://[HOSTNAME_OR_IP]/v1') // Make sure your endpoint is accessible .setProject('5ff3379a01d25') // Your project ID .setKey('cd868c7af8bdc893b4...93b7535db89') .setSelfSigned()

2002Bishwajeet commented 2 years ago
Client client = Client(); --> There should be no semi-colon
.setEndpoint('http://[HOSTNAME_OR_IP]/v1') // Make sure your endpoint is accessible
.setProject('5ff3379a01d25') // Your project ID
.setKey('cd868c7af8bdc893b4...93b7535db89')
.setSelfSigned()
Tananga commented 2 years ago

And ; at the end

2002Bishwajeet commented 2 years ago

yup- a typo

lohanidamodar commented 2 years ago

This issue should now be fixed. Feel free to reopen if you still have issues.