cancel
Showing results for 
Search instead for 
Did you mean: 

Join the community at Nodes 2022, our free virtual event on November 16 - 17.

Cannot connect to mobile_client_flutter from GRANDStack starter NodeJs server

asim1999
Node

Hi all,
So i am trying to get the GRANDStack starter up and running.
So far i have got the server up and running by using this guide

This is my .env file in the API directory:

This is the URL that is started up when i run "npm run start"

http://localhost:4001/graphql

When i connect to the app using the built in mobile_client_flutter project i get a connection error

Here is the error within the app

Any advice and help would be appreciated

Thanks

1 REPLY 1

john3haris
Node Clone

Hello @asim1999 .

Start by installing universal_platform package in the pubspec.yaml file.

And import the package to the file where you're declaring the url.

import 'package:universal_platform/universal_platform.dart';

And now make sure your URL looks like this.

String url = UniversalPlatform.isAndroid
      ? 'http://your_ip_address:4001/graphql'
      : 'http://localhost:4001/graphql';

change your_up_adress with your actual IP address eg; (192.168. 1.1).
Good luck.