networkMethodStub function
String
networkMethodStub({
- required String methodName,
- Map<
String, dynamic> queryParams = const {}, - Map<
String, dynamic> headerParams = const {}, - Map<
String, dynamic> dataParams = const {}, - Map<
String, dynamic> pathParams = const {}, - String? model,
- bool isList = false,
- String path = "",
- required String method,
- String? urlFullPath,
Creates a network method
Implementation
String networkMethodStub({
required String methodName,
Map<String, dynamic> queryParams = const {},
Map<String, dynamic> headerParams = const {},
Map<String, dynamic> dataParams = const {},
Map<String, dynamic> pathParams = const {},
String? model,
bool isList = false,
String path = "",
required String method,
String? urlFullPath,
}) =>
'''
//$method\n${urlFullPath != null ? ' /// $urlFullPath' : ''}
Future<${_getType(model, isList: isList, isOptional: true)}> $methodName(${_mapParams(queryParams, dataParams, pathParams)}) async => await network${_getType(model, isList: isList, returnDynamic: false, addBrackets: true)}(
${_callBackType(headers: headerParams, method: method, path: path, queryParams: queryParams, dataParams: dataParams, pathParams: pathParams)}
${urlFullPath != null ? 'baseUrl: "${Uri.parse(urlFullPath).origin}"' : ''}
);
''';