I don't know where I'm wrong is this any new updated change in cameraDeepAr

Error List:

non-nullable instance field 'cameraDeepArController' must be initialized. Try adding an initializer expression, or a generative constructor that initializes it, or mark it 'late

Undefined class 'Effects'. Try changing the name to the name of an existing class, or creating a class with the name 'Effects'.

Undefined class 'Filters'. Try changing the name to the name of an existing class, or creating a class with the name 'Filters'.

Undefined class 'Masks'. Try changing the name to the name of an existing class, or creating a class with the name 'Masks'.

The method 'changeMask' isn't defined for the type 'CameraDeepArController'. Try correcting the name to the name of an existing method, or defining a method named 'changeMask'.

(https://i.stack.imgur.com/fNx3h.png)][[[enter image description here](https://i.stack.imgur.com/ubhrS.png)](https://i.stack.imgur.com/d3B1K.png)](https://i.stack.imgur.com/SQLLu.png)(https://i.stack.imgur.com/XF3cb.png)

import 'package:avatar_view/avatar_view.dart';
import 'package:camera_deep_ar/camera_deep_ar.dart';
import 'package:flutter/material.dart';
import 'dart:io' as Platform;

class CameraMaskFiltersScreen extends StatefulWidget {
  @override
  _CameraMaskFiltersScreenState createState() =>
      _CameraMaskFiltersScreenState();
}

class _CameraMaskFiltersScreenState extends State<CameraMaskFiltersScreen> {
  CameraDeepArController cameraDeepArController;
  String platformVersion = "Unkown";
  int currentPage = 0;
  final vp = PageController(viewportFraction: .24);
  Effects currentEffects = Effects.none;
  Filters currentFilters = Filters.none;
  Masks currentMask = Masks.none;
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        backgroundColor: Colors.grey,
        body: Stack(
          children: [
            CameraDeepAr(
              onCameraReady: (isReady) {
                platformVersion = "Camera Status $isReady";
                print(platformVersion);
                setState(() {});
              },
              cameraDeepArCallback: (c) async {
                cameraDeepArController = c;
                setState(() {});
              },
            ),
            Align(
              alignment: Alignment.bottomCenter,
              child: Container(
                padding: EdgeInsets.all(20.0),
                child: Column(
                  mainAxisSize: MainAxisSize.min,
                  mainAxisAlignment: MainAxisAlignment.end,
                  children: [
                    SingleChildScrollView(
                      scrollDirection: Axis.horizontal,
                      child: Row(
                        children: List.generate(8, (page) {
                          bool active = currentPage == page;
                          return Platform.Platform.isIOS
                              ? GestureDetector(
                                  onTap: () {
                                    currentPage = page;
                                    cameraDeepArController.changeMask(page);
                                    setState(() {});
                                  },
                                  child: AvatarView(
                                    radius: active ? 65 : 30,
                                    borderColor: Colors.yellowAccent,
                                    borderWidth: 2,
                                    isOnlyText: false,
                                    avatarType: AvatarType.CIRCLE,
                                    backgroundColor: Colors.amberAccent,
                                    imagePath:
                                        "assets/android/${page.toString()}.jpg",
                                    placeHolder: Icon(
                                      Icons.person,
                                      size: 50,
                                    ),
                                    errorWidget: Container(
                                      child: Icon(
                                        Icons.error,
                                        size: 50,
                                      ),
                                    ),
                                  ),
                                )
                              : GestureDetector(
                                  onTap: () {
                                    currentPage = page;
                                    cameraDeepArController.changeMask(page);
                                    setState(() {});
                                  },
                                  child: AvatarView(
                                    radius: active ? 45 : 20,
                                    borderColor: Colors.yellowAccent,
                                    borderWidth: 2,
                                    isOnlyText: false,
                                    avatarType: AvatarType.CIRCLE,
                                    backgroundColor: Colors.amberAccent,
                                    imagePath:
                                        "assets/ios/${page.toString()}.jpg",
                                    placeHolder: Icon(
                                      Icons.person,
                                      size: 50,
                                    ),
                                    errorWidget: Container(
                                      child: Icon(
                                        Icons.error,
                                        size: 50,
                                      ),
                                    ),
                                  ),
                                );
                        }),
                      ),
                    ),
                  ],
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
0

There are 0 best solutions below