createCow method Null safety

Future<Cow?> createCow(
  1. Cow _
)

소를 신규로 등록합니다.

Implementation

Future<Cow?> createCow(Cow _) async {
  LogManager().addLog("createCow", screen: runtimeType.toString());

  try {
    await reqPOST(
      path: '/api/cows',
      queryParameters: {},
      body: Utf8Encoder().convert(json.encode(_.toJson())),
    );
    return _;
  } catch (e) {
    LogManager().addLog('createCow call failed: $e', screen: runtimeType.toString());
    return null;
  }
}