networkMethodStub function

String networkMethodStub({
  1. required String methodName,
  2. Map<String, dynamic> queryParams = const {},
  3. Map<String, dynamic> headerParams = const {},
  4. Map<String, dynamic> dataParams = const {},
  5. Map<String, dynamic> pathParams = const {},
  6. String? model,
  7. bool isList = false,
  8. String path = "",
  9. required String method,
  10. 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}"' : ''}
  );
''';