call_logs_plus 0.0.3 copy "call_logs_plus: ^0.0.3" to clipboard
call_logs_plus: ^0.0.3 copied to clipboard

PlatformAndroid

A Flutter plugin for accessing call logs, created for educational and learning purposes only. Not intended for production or commercial use.

example/lib/main.dart

import 'package:call_logs_plus/logs.dart';
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart';

import 'clog.dart';


void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home:
      CallLogsPage()
    );
  }
}


class CallLogsPage extends StatefulWidget {
  const CallLogsPage({super.key});

  @override
  State<CallLogsPage> createState() => _CallLogsPageState();
}

class _CallLogsPageState extends State<CallLogsPage> {
  final CallLogsPlugin _plugin = CallLogsPlugin();
  List<CallLogEntry> _logs = [];
  bool _loading = true;

  @override
  void initState() {
    super.initState();
    _initializePlugin();
  }

  Future<void> _initializePlugin() async {
    await _plugin.checkPermissions();
    _plugin.callLogsStream.listen((data) {
      setState(() {
        _logs = data;
        _loading = false;
      });
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Call Logs')),
      body: _loading
          ? const Center(child: CircularProgressIndicator())
          : ListView.builder(
        itemCount: _logs.length,
        itemBuilder: (context, index) {
          final log = _logs[index];
          return Card(
            child: ListTile(
              leading: const Icon(Icons.call),
              title: Text(log.name.isNotEmpty ? log.name : log.number),
              subtitle: Text('${log.type} | ${log.duration}s | ${log.dateTime}'),
              trailing: Text(log.simName),
            ),
          );
        },
      ),
    );
  }
}
3
likes
150
points
19
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter plugin for accessing call logs, created for educational and learning purposes only. Not intended for production or commercial use.

Homepage

Documentation

API reference

License

MIT (license)

Dependencies

flutter, flutter_web_plugins, plugin_platform_interface, web

More

Packages that depend on call_logs_plus

Packages that implement call_logs_plus