You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am reaching out regarding a project I am currently undertaking involving the development of a Flutter app. This project necessitates real-time data integration from the server socket, which is built using Feathers.js. After extensive research, I discovered that your plugin is the sole option available on pub.dev that meets our requirements.
I diligently followed the provided documentation to integrate the plugin into our application. However, despite our efforts, we encountered difficulties in retrieving data or user information, with occasional failures in the re-authentication process.
In light of this, I would greatly appreciate it if you could spare some time to review the attached main.dart file. Your expertise in this matter would be invaluable in identifying any potential mistakes or oversights in our implementation.
import'dart:developer';
import'package:flutter/material.dart';
import'package:flutter_feathersjs/flutter_feathersjs.dart';
import'package:socket_io_client/socket_io_client.dart'as IO;
//Using following dependencies :// flutter_feathersjs: ^4.1.3// flutter_slidable: ^3.0.0// http: ^0.13.5// logger: ^1.3.0// socket_io_client: ^1.0.2// username_gen: ^1.0.4//Variables to store login dataconstBASE_URL='';
constUserName='';
constPassword='';
constStrategy="local";
// Main Functionvoidmain() {
WidgetsFlutterBinding.ensureInitialized();
runApp(constMyApp());
}
// Configuration for AppclassMyAppextendsStatelessWidget {
constMyApp({super.key});
@overrideWidgetbuild(BuildContext context) {
returnMaterialApp(
title:'FlutterFeathersJS',
debugShowCheckedModeBanner:false,
theme:ThemeData(
primarySwatch:Colors.blue,
fontFamily:"Abel",
scaffoldBackgroundColor:constColor(0xffF5F5F3),
),
home:constMySocketData(),
);
}
}
// Class to get Data from socket and manage itclassMySocketDataextendsStatefulWidget {
constMySocketData({Key? key}) :super(key: key);
@overrideState<MySocketData> createState() =>_MySocketDataState();
}
class_MySocketDataStateextendsState<MySocketData> {
lateFlutterFeathersjs flutterFeathersjs;
lateFlutterFeathersjs client;
@overridevoidinitState() {
super.initState();
// initialization of client
flutterFeathersjs =FlutterFeathersjs()..init(baseUrl:BASE_URL);
// Login to server socket and get data from servicegetData();
}
Future<void> getData() async {
await flutterFeathersjs.init(baseUrl:BASE_URL);
try {
// Authenticateawait flutterFeathersjs
.authenticate(
userName:UserName,
password:Password,
strategy:Strategy,
)
.then((response) {
log("Login Response: $response");
}).onError((error, stackTrace) {
log("Auth Error: $error");
log("Auth StackTrace: $stackTrace");
});
log("Login Successful");
// Re-Authenticatevar response =await flutterFeathersjs.reAuthenticate();
print('RE-Auth : $response');
// Getting Userawait flutterFeathersjs.user().then((value) {
log("User : $value");
});
// Connecting to servicedynamic a =await flutterFeathersjs.service("fire-data").then((value) {
log("Fire data: ${value.toString()}");
});
} catch (e) {
// Catch errorslog("<>- Error -<>: \n$e");
}
}
// Empty Screen (Output in Terminal)@overrideWidgetbuild(BuildContext context) {
returnScaffold(
appBar:AppBar(
title:constText('Socket Data Service'),
),
body:Center(
child:SingleChildScrollView(
child:Container(
child:Text("Check Terminal..."),
),
),
),
);
}
}
The text was updated successfully, but these errors were encountered:
I am reaching out regarding a project I am currently undertaking involving the development of a Flutter app. This project necessitates real-time data integration from the server socket, which is built using Feathers.js. After extensive research, I discovered that your plugin is the sole option available on pub.dev that meets our requirements.
I diligently followed the provided documentation to integrate the plugin into our application. However, despite our efforts, we encountered difficulties in retrieving data or user information, with occasional failures in the re-authentication process.
In light of this, I would greatly appreciate it if you could spare some time to review the attached main.dart file. Your expertise in this matter would be invaluable in identifying any potential mistakes or oversights in our implementation.
The text was updated successfully, but these errors were encountered: