Skip to content

Lifecycle methods triggered with platform views #124452

@thisisamank

Description

@thisisamank

I have an AndroidView

class TextViewAndroid {
...
}

and I have a platform view that returns this view so

class TextPlatformView {
...
}

This class serves the PlatformView :

class TextView extends StatelessWidget {
  const TextView({super.key});

  @override
  Widget build(BuildContext context) {
    const String viewType = 'textView';
    final Map<String, dynamic> creationParams = <String, dynamic>{};

    return AndroidView(
      viewType: viewType,
      layoutDirection: TextDirection.ltr,
      creationParams: creationParams,
      creationParamsCodec: const StandardMessageCodec(),
    );
  }
}

There are two screens on the flutter end. Each screen has one TextView

class FirstPage extends StatelessWidget {
  const FirstPage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('First Page'),
      ),
      body: const Center(
        child: TextView(),
      ),
    );
  }
}

class SecondPage extends StatelessWidget {
  const SecondPage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Second Page'),
      ),
      body: const Center(
        child: TextView(),
      ),
    );
  }
}

When I go from one screen to another screen and come back to the first I want to know the lifecycle method which is triggered for the TextViewAndroid on the first screen. Is there a way to know it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    r: invalidIssue is closed as not valid

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions