flutter로 푸시하기 android

import 'package:flutter/material.dart';
import 'package:firebase_messaging/firebase_messaging.dart';

void main() => runApp(new MyApp());

class MyApp extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
        return new MaterialApp(
            title: 'Flutter Demo',
            theme: new ThemeData(
                primarySwatch: Colors.blue,
            ),
            home: new MyHomePage(title: 'Flutter Demo Home Page'),
        );
    }
}

class MyHomePage extends StatefulWidget {
    MyHomePage({Key key, this.title}) : super(key: key);

    final String title;

    @override
    _MyHomePageState createState() => new _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
    FirebaseMessaging _firebaseMessaging = new FirebaseMessaging();

    @override
    void initState() {
        super.initState();
        _firebaseMessaging.configure(
            onMessage: (Map<String, dynamic> message) {
                print('on message $message');
            },
            onResume: (Map<String, dynamic> message) {
                print('on resume $message');
            },
            onLaunch: (Map<String, dynamic> message) {
                print('on launch $message');
            },
        );
        _firebaseMessaging.requestNotificationPermissions(
            const IosNotificationSettings(sound: true, badge: true, alert: true));
        _firebaseMessaging.getToken().then((token){
            print(token);
        });
    }

    @override
    Widget build(BuildContext context) {
        return new Scaffold(
            appBar: new AppBar(
                title: new Text(widget.title),
            )
        );
    }
}
dependencies:
  flutter:
    sdk: flutter

  cupertino_icons: ^0.1.2
  firebase_messaging: ^4.0.0+1
dependencies {
    implementation 'com.google.firebase:firebase-core:16.0.1'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
apply plugin: 'com.google.gms.google-services'
buildscript {
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.2'
        classpath 'com.google.gms:google-services:4.2.0'

    }
}
<?php
    $headers = array('Content-Type:application/json', 'Authorization:key=<Server key>');
 
    $arr = array();
    $arr['notification']['title'] = "<TITLE>";
    $arr['notification']['body'] = "<BODY>";
    $arr['notification']['icon'] = "<ICON>";
    $arr['notification']['sound'] = "<SOUND>";    
    $arr['registration_ids'] = array('<TOKEN>');
 
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, 'https://fcm.googleapis.com/fcm/send');
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_POSTFIELDS,json_encode($arr));
    $response = curl_exec($ch);
    curl_close($ch);
    echo $response;
?>