小编Dav*_*ing的帖子

Flutter auto_route,getter 'key' 被调用为 null

import 'package:myapp/core/routes/router.gr.dart' as app_router;

child: MaterialApp(
    title: 'MyApp',
    debugShowCheckedModeBanner: false,
    builder: ExtendedNavigator.builder<app_router.Router>(
      router: app_router.Router()
    ),
Run Code Online (Sandbox Code Playgroud)

我已经实现了自动路由,但是我在这里收到一个错误,即 getter 键被调用为 null

dart flutter

4
推荐指数
1
解决办法
1392
查看次数

Laravel 响应是 String 而不是 int

public function create(Request $request){
    $comment = new Comment;
    $comment->user_id = Auth::user()->id;
    $comment->post_id = $request->id; //here is where the response is string
    $comment->comment = $request->comment;
    $comment->save();
    $comment->user;

    return response()->json(
        $comment,
    );
}
Run Code Online (Sandbox Code Playgroud)

我不知道为什么响应是字符串 id 并且在数据库迁移中 post_id 表$table->unsignedBigInteger('post_id');是否应该是整数..

{
"user_id": 4,
"post_id": "2", //response is string 
"comment": "test string id finale",
"updated_at": "2020-10-31T19:55:49.000000Z",
"created_at": "2020-10-31T19:55:49.000000Z",
"id": 11,
}
Run Code Online (Sandbox Code Playgroud)

php laravel

2
推荐指数
1
解决办法
2096
查看次数

标签 统计

dart ×1

flutter ×1

laravel ×1

php ×1