userid.dart 390 B

123456789101112131415
  1. import 'package:flutter/material.dart';
  2. import 'package:provider/provider.dart';
  3. import 'package:sport/provider/user_model.dart';
  4. mixin UserId<T extends StatefulWidget> on State<T> {
  5. late String selfId;
  6. late int intUserId;
  7. @override
  8. void initState() {
  9. super.initState();
  10. intUserId = Provider.of<UserModel>(context, listen: false).user.id;
  11. selfId = "$intUserId";
  12. }
  13. }