abstract class ApiCalls {
Future<NoteModel?> createNote(NoteModel value);
Future<List<NoteModel?>> getAllNotes();
Future<NoteModel?> updateNote(NoteModel value);
Future<void> deleteNote(String id);
}
class NoteDB extends ApiCalls {
final dio = Dio();
final url = Url();
@override
Future<NoteModel?> createNote(NoteModel value) async {
try {
final _result = await dio.post<NoteModel>(
url.baseUrl + url.addNote,
data: value.toJson(),
);
return _result.data;
} on DioError catch (e) {
print(e.response?.data);
print(e);
} catch (e) {
print(e.toString());
}
}
still not possible to create. the error shown from the console while saveNote connected to save icon says:
flutter (30312): null
I/flutter (30312): DioError [DioErrorType.connectTimeout]: Connecting timed out [0ms]
I/flutter (30312): Source stack:
I/flutter (30312): #0 DioMixin.fetch
package:dio/src/dio_mixin.dart:488
I/flutter (30312): #1 DioMixin.request
package:dio/src/dio_mixin.dart:483
I/flutter (30312): #2 DioMixin.post
package:dio/src/dio_mixin.dart:97
can,t get it to the console and api. null exception is thrown but after try and catch used but still showing. how can i solve Connecting timed out [0ms]or where should i change the time duration [0] to [3000].